146 references to WebSocketState
dotnet-svcutil-lib (5)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ClientWebSocketTransportDuplexSessionChannel.cs (1)
233if (ws.State != WebSocketState.Open)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (4)
1264if (!_endofMessageReceived && (_webSocket.State == WebSocketState.Open || _webSocket.State == WebSocketState.CloseSent)) 1277(_webSocket.State == WebSocketState.Open || 1278_webSocket.State == WebSocketState.CloseSent));
Interop.FunctionalTests (1)
Http2WebSocketInteropTests.cs (1)
163Assert.Equal(WebSocketState.Aborted, wsClient.State);
Microsoft.AspNetCore.Http.Connections (3)
Internal\Transports\WebSocketsServerTransport.cs (3)
303return !(ws.State == WebSocketState.Aborted || 304ws.State == WebSocketState.Closed || 305ws.State == WebSocketState.CloseSent);
Microsoft.AspNetCore.Http.Connections.Client (3)
Internal\WebSocketsTransport.cs (3)
635return !(ws.State == WebSocketState.Aborted || 636ws.State == WebSocketState.Closed || 637ws.State == WebSocketState.CloseSent);
Microsoft.AspNetCore.Http.Connections.Tests (12)
TestWebSocketConnectionFeature.cs (10)
65private WebSocketState _state; 79public override WebSocketState State => _state; 86_state = WebSocketState.Aborted; 104_state = WebSocketState.CloseSent; 119_state = WebSocketState.CloseSent; 126_state = WebSocketState.Closed; 142_state = WebSocketState.CloseReceived; 178_state = WebSocketState.Aborted; 239_state = WebSocketState.CloseReceived; 248_state = WebSocketState.Closed;
WebSocketsTests.cs (2)
227Assert.Equal(WebSocketState.Aborted, serverSocket.State); 263Assert.Equal(WebSocketState.Aborted, serverSocket.State);
Microsoft.AspNetCore.Owin (22)
WebSockets\OwinWebSocketAdapter.cs (16)
37private WebSocketState _state; 51_state = WebSocketState.Open; 93public override WebSocketState State 108if (State == WebSocketState.Open) 110_state = WebSocketState.CloseReceived; 112else if (State == WebSocketState.CloseSent) 114_state = WebSocketState.Closed; 133if (State == WebSocketState.Open || State == WebSocketState.CloseReceived) 141while (State == WebSocketState.CloseSent) 157if (State == WebSocketState.Open) 159_state = WebSocketState.CloseSent; 161else if (State == WebSocketState.CloseReceived) 163_state = WebSocketState.Closed; 171_state = WebSocketState.Aborted; 177_state = WebSocketState.Closed;
WebSockets\WebSocketAdapter.cs (6)
123case WebSocketState.Closed: // Closed gracefully, no action needed. 124case WebSocketState.Aborted: // Closed abortively, no action needed. 126case WebSocketState.CloseReceived: 131case WebSocketState.Open: 132case WebSocketState.CloseSent: // No close received, abort so we don't have to drain the pipe. 136throw new NotSupportedException($"Unsupported {nameof(WebSocketState)} value: {_webSocket.State}.");
Microsoft.AspNetCore.SignalR.Client.Tests (2)
WebSocketsTransportTests.cs (2)
49public override WebSocketState State => WebSocketState.Open;
Microsoft.AspNetCore.SpaServices.Extensions (2)
Proxying\SpaProxy.cs (2)
302if (destination.State == WebSocketState.Open || destination.State == WebSocketState.CloseReceived)
Microsoft.AspNetCore.TestHost (21)
TestWebSocket.cs (21)
13private WebSocketState _state; 36public override WebSocketState State 50if (State == WebSocketState.Open || State == WebSocketState.CloseReceived) 56if (State == WebSocketState.CloseSent) 77if (State == WebSocketState.Open) 79_state = WebSocketState.CloseSent; 81else if (State == WebSocketState.CloseReceived) 83_state = WebSocketState.Closed; 90if (_state >= WebSocketState.Closed) // or Aborted 95_state = WebSocketState.Aborted; 101if (_state >= WebSocketState.Closed) // or Aborted 106_state = WebSocketState.Closed; 128if (_state == WebSocketState.Open) 130_state = WebSocketState.CloseReceived; 132else if (_state == WebSocketState.CloseSent) 134_state = WebSocketState.Closed; 175ObjectDisposedException.ThrowIf(_state >= WebSocketState.Closed, typeof(TestWebSocket)); // or Aborted 180if (State == WebSocketState.CloseSent) 188if (State == WebSocketState.CloseReceived) 212_state = WebSocketState.Open;
Microsoft.AspNetCore.TestHost.Tests (3)
TestClientTests.cs (3)
623Assert.Equal(WebSocketState.CloseSent, clientSocket.State); 638Assert.Equal(WebSocketState.Closed, clientSocket.State); 689Assert.Equal(WebSocketState.CloseReceived, clientSocket.State);
Microsoft.AspNetCore.WebSockets (3)
AbortStream.cs (3)
11/// so that we can call <see cref="HttpContext.Abort"/> when the stream is disposed and the WebSocket is in the <see cref="WebSocketState.Aborted"/> state. 15/// This handles explicit <see cref="WebSocket.Abort"/> calls as well as the Keep-Alive timeout setting <see cref="WebSocketState.Aborted"/> and disposing the stream. 123if (WebSocket?.State == WebSocketState.Aborted)
Microsoft.AspNetCore.WebSockets.Tests (11)
WebSocketMiddlewareTests.cs (11)
366Assert.Equal(WebSocketState.CloseSent, client.State); 394Assert.Equal(WebSocketState.CloseReceived, client.State); 424Assert.Equal(WebSocketState.Closed, client.State); 453Assert.Equal(WebSocketState.CloseSent, client.State); 456Assert.Equal(WebSocketState.Closed, client.State); 492Assert.Equal(WebSocketState.CloseReceived, client.State); 496Assert.Equal(WebSocketState.Closed, client.State); 522while (serverSocket.State is WebSocketState.Open or WebSocketState.CloseSent) 599while (serverSocket.State is WebSocketState.Open or WebSocketState.CloseSent)
netstandard (1)
netstandard.cs (1)
1319[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.WebSockets.WebSocketState))]
System (1)
src\libraries\shims\System\ref\System.cs (1)
810[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.WebSockets.WebSocketState))]
System.Net.WebSockets (46)
System\Net\WebSockets\ManagedWebSocket.cs (33)
78private WebSocketState _state = WebSocketState.Open; 246WebSocketState state = _state; 247if (state < WebSocketState.Aborted) 249_state = WebSocketState.Closed; 293public override WebSocketState State => _state; 467WebSocketState state = _state; 468if (state is not WebSocketState.Closed and not WebSocketState.Aborted) 470_state = state is not WebSocketState.None and not WebSocketState.Connecting ? 471WebSocketState.Aborted : 472WebSocketState.Closed; 548_state == WebSocketState.Aborted ? CreateOperationCanceledException(exc) : 588throw _state == WebSocketState.Aborted ? 628throw _state == WebSocketState.Aborted ? 1018if (_state == WebSocketState.Aborted) 1029throw new OperationCanceledException(nameof(WebSocketState.Aborted), inner); 1073WebSocketState state = _state; 1074if (_sentCloseFrame && state < WebSocketState.Closed) 1076_state = WebSocketState.Closed; 1078else if (state < WebSocketState.CloseReceived) 1080_state = WebSocketState.CloseReceived; 1436State == WebSocketState.CloseSent || 1437State == WebSocketState.Closed || 1438State == WebSocketState.Aborted, 1444if (State == WebSocketState.CloseSent) 1553WebSocketState state = _state; 1554if (_receivedCloseFrame && state < WebSocketState.Closed) 1556_state = WebSocketState.Closed; 1558else if (state < WebSocketState.CloseSent) 1560_state = WebSocketState.CloseSent; 1736WebSocketState state = _state;
System\Net\WebSockets\ManagedWebSocket.KeepAlive.cs (2)
263if (_parent.State is WebSocketState.Closed) 273if (_parent.State is WebSocketState.Aborted)
System\Net\WebSockets\WebSocket.cs (7)
18public abstract WebSocketState State { get; } 90protected static void ThrowOnInvalidState(WebSocketState state, params WebSocketState[] validStates) 96foreach (WebSocketState currentState in validStates) 110protected static bool IsStateTerminal(WebSocketState state) => 111state == WebSocketState.Closed || state == WebSocketState.Aborted;
System\Net\WebSockets\WebSocketStateHelper.cs (4)
19internal static bool IsValidSendState(WebSocketState state) => ValidSendStates.HasFlag(ToFlag(state)); 21internal static void ThrowIfInvalidState(WebSocketState currentState, bool isDisposed, Exception? innerException, ManagedWebSocketStates validStates) 36throw new OperationCanceledException(nameof(WebSocketState.Aborted), innerException); 43private static ManagedWebSocketStates ToFlag(WebSocketState value)
System.Net.WebSockets.Client (10)
System\Net\WebSockets\ClientWebSocket.cs (4)
32public override WebSocketState State 45return WebSocketState.None; 47return WebSocketState.Connecting; 50return WebSocketState.Closed;
System\Net\WebSockets\WebSocketHandle.Managed.cs (6)
26private WebSocketState _state = WebSocketState.Connecting; 30public WebSocketState State => WebSocket?.State ?? _state; 39_state = WebSocketState.Closed; 208if (_state < WebSocketState.Closed) 210_state = WebSocketState.Closed;