mirror of
				https://github.com/nsnail/Ocelot.git
				synced 2025-11-04 15:30:49 +08:00 
			
		
		
		
	Modified WebSocketMiddleWare to close connection on premature close (#998)
This commit is contained in:
		
				
					committed by
					
						
						Thiago Loureiro
					
				
			
			
				
	
			
			
			
						parent
						
							0ac77f2e50
						
					
				
				
					commit
					b6f3f0f28a
				
			@@ -47,6 +47,15 @@ namespace Ocelot.WebSockets.Middleware
 | 
			
		||||
                    await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
 | 
			
		||||
                    return;
 | 
			
		||||
                }
 | 
			
		||||
                catch (WebSocketException e)
 | 
			
		||||
                {
 | 
			
		||||
                    if (e.WebSocketErrorCode == WebSocketError.ConnectionClosedPrematurely)
 | 
			
		||||
                    {
 | 
			
		||||
                        await destination.CloseOutputAsync(WebSocketCloseStatus.EndpointUnavailable, null, cancellationToken);
 | 
			
		||||
                        return;
 | 
			
		||||
                    }
 | 
			
		||||
                    throw;
 | 
			
		||||
                }
 | 
			
		||||
 | 
			
		||||
                if (result.MessageType == WebSocketMessageType.Close)
 | 
			
		||||
                {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user