137 references to WebSocketCloseStatus
dotnet-svcutil-lib (5)
ExceptionHandlerSample (1)
InProcessWebSite (1)
Interop.FunctionalTests (2)
Microsoft.AspNetCore.Http.Connections (3)
Microsoft.AspNetCore.Http.Connections.Client (7)
Microsoft.AspNetCore.Http.Connections.Tests (23)
TestWebSocketConnectionFeature.cs (8)
63private WebSocketCloseStatus? _closeStatus;
75public override WebSocketCloseStatus? CloseStatus => _closeStatus;
94public override async Task CloseAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
109public override async Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
225CloseStatus = WebSocketCloseStatus.InternalServerError,
249_closeStatus = WebSocketCloseStatus.InternalServerError;
250return new WebSocketConnectionSummary(frames, new WebSocketReceiveResult(0, WebSocketMessageType.Close, endOfMessage: true, closeStatus: WebSocketCloseStatus.InternalServerError, closeStatusDescription: ""));
282public WebSocketCloseStatus? CloseStatus { get; set; }
WebSocketsTests.cs (11)
52await feature.Client.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None);
67Assert.Equal(WebSocketCloseStatus.NormalClosure, clientSummary.CloseResult.CloseStatus);
100await feature.Client.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None);
190Assert.Equal(WebSocketCloseStatus.InternalServerError, clientSummary.CloseResult.CloseStatus);
193await feature.Client.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None);
298await feature.Client.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, null, CancellationToken.None).DefaultTimeout();
302Assert.Equal(WebSocketCloseStatus.NormalClosure, serverSocket.CloseStatus);
332await feature.Client.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, null, CancellationToken.None).DefaultTimeout();
341Assert.Equal(WebSocketCloseStatus.NormalClosure, serverSocket.CloseStatus);
386await feature.Client.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, null, CancellationToken.None).DefaultTimeout();
412await serverSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", default);
Microsoft.AspNetCore.Owin (7)
Microsoft.AspNetCore.SignalR.Client.Tests (3)
Microsoft.AspNetCore.SignalR.Tests (5)
Microsoft.AspNetCore.TestHost (6)
Microsoft.AspNetCore.TestHost.Tests (7)
TestClientTests.cs (5)
590await websocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Normal Closure", CancellationToken.None);
620await clientSocket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Normal Closure", CancellationToken.None);
658await websocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Normal Closure", CancellationToken.None);
667await websocket.CloseAsync(WebSocketCloseStatus.InternalServerError, closeReason, CancellationToken.None);
712await websocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "Normal Closure", CancellationToken.None);
Microsoft.AspNetCore.WebSockets.Tests (14)
WebSocketMiddlewareTests.cs (12)
357Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
364await client.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
380await webSocket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
391Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
413Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
422await client.CloseAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
443Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
452await client.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
455await client.CloseAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
470await webSocket.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, closeDescription, CancellationToken.None);
477Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
489Assert.Equal(WebSocketCloseStatus.NormalClosure, result.CloseStatus);
netstandard (1)
System (1)
System.Net.HttpListener (3)
System.Net.WebSockets (40)
System\Net\WebSockets\ManagedWebSocket.cs (32)
86private WebSocketCloseStatus? _closeStatus;
289public override WebSocketCloseStatus? CloseStatus => _closeStatus;
399public override Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
418public override Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
426private async Task CloseOutputAsyncCore(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
854await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.ProtocolError, WebSocketError.Faulted, headerErrorMessage).ConfigureAwait(false);
988await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.InvalidPayloadData, WebSocketError.Faulted).ConfigureAwait(false);
1086WebSocketCloseStatus closeStatus = WebSocketCloseStatus.NormalClosure;
1093await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.ProtocolError, WebSocketError.Faulted).ConfigureAwait(false);
1107closeStatus = (WebSocketCloseStatus)BinaryPrimitives.ReadUInt16BigEndian(_receiveBuffer.Span.Slice(_receiveBufferOffset));
1110await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.ProtocolError, WebSocketError.Faulted).ConfigureAwait(false);
1121await CloseWithReceiveErrorAndThrowAsync(WebSocketCloseStatus.ProtocolError, WebSocketError.Faulted, innerException: exc).ConfigureAwait(false);
1230private static bool IsValidCloseStatus(WebSocketCloseStatus closeStatus)
1238if (closeStatus < (WebSocketCloseStatus)1000 || closeStatus >= (WebSocketCloseStatus)5000)
1243if (closeStatus >= (WebSocketCloseStatus)3000)
1250case WebSocketCloseStatus.EndpointUnavailable:
1251case WebSocketCloseStatus.InternalServerError:
1252case WebSocketCloseStatus.InvalidMessageType:
1253case WebSocketCloseStatus.InvalidPayloadData:
1254case WebSocketCloseStatus.MandatoryExtension:
1255case WebSocketCloseStatus.MessageTooBig:
1256case WebSocketCloseStatus.NormalClosure:
1257case WebSocketCloseStatus.PolicyViolation:
1258case WebSocketCloseStatus.ProtocolError:
1259case (WebSocketCloseStatus)1012: // ServiceRestart
1260case (WebSocketCloseStatus)1013: // TryAgainLater
1261case (WebSocketCloseStatus)1014: // BadGateway
1275WebSocketCloseStatus closeStatus, WebSocketError error, string? errorMessage = null, Exception? innerException = null)
1420private async Task CloseAsyncPrivate(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
1518private async ValueTask SendCloseFrameAsync(WebSocketCloseStatus closeStatus, string? closeStatusDescription, CancellationToken cancellationToken)
System.Net.WebSockets.Client (6)
WebSocketSample (2)