7 types derived from WebSocket
Microsoft.AspNetCore.Http.Connections.Tests (1)
TestWebSocketConnectionFeature.cs (1)
57public class WebSocketChannel : WebSocket
Microsoft.AspNetCore.Owin (1)
WebSockets\OwinWebSocketAdapter.cs (1)
30public class OwinWebSocketAdapter : WebSocket
Microsoft.AspNetCore.SignalR.Client.Tests (1)
WebSocketsTransportTests.cs (1)
41internal class TestWebSocket : WebSocket
Microsoft.AspNetCore.TestHost (1)
TestWebSocket.cs (1)
8internal sealed class TestWebSocket : WebSocket
System.Net.WebSockets (2)
System\Net\WebSockets\ManagedWebSocket.cs (1)
30internal sealed partial class ManagedWebSocket : WebSocket
System\Net\WebSockets\ManagedWebSocket.KeepAlive.cs (1)
12internal sealed partial class ManagedWebSocket : WebSocket
System.Net.WebSockets.Client (1)
System\Net\WebSockets\ClientWebSocket.cs (1)
12public sealed partial class ClientWebSocket : WebSocket
167 references to WebSocket
AutobahnTestApp (2)
Startup.cs (2)
21using (var webSocket = await context.WebSockets.AcceptWebSocketAsync(new WebSocketAcceptContext() 39private async Task Echo(WebSocket webSocket, CancellationToken cancellationToken)
dotnet-svcutil-lib (12)
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ClientWebSocketFactory.cs (1)
23public abstract Task<WebSocket> CreateWebSocketAsync(Uri address, WebHeaderCollection headers, ICredentials credentials, WebSocketTransportSettings settings, TimeoutHelper timeoutHelper);
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\ClientWebSocketTransportDuplexSessionChannel.cs (2)
190private async Task<WebSocket> CreateWebSocketWithFactoryAsync(X509Certificate2 certificate, TimeoutHelper timeoutHelper) 200WebSocket ws;
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\CoreClrClientWebSocketFactory.cs (1)
16public override async Task<WebSocket> CreateWebSocketAsync(Uri address, WebHeaderCollection headers, ICredentials credentials,
FrameworkFork\System.ServiceModel\System\ServiceModel\Channels\WebSocketTransportDuplexSessionChannel.cs (8)
23private WebSocket _webSocket; 40protected WebSocket WebSocket 465private WebSocket _webSocket; 478public WebSocketMessageSource(WebSocketTransportDuplexSessionChannel webSocketTransportDuplexSessionChannel, WebSocket webSocket, 486private void Initialize(WebSocketTransportDuplexSessionChannel webSocketTransportDuplexSessionChannel, WebSocket webSocket, bool useStreaming, IDefaultCommunicationTimeouts defaultTimeouts) 888private readonly WebSocket _webSocket; 907WebSocket webSocket, 924WebSocket webSocket,
ExceptionHandlerSample (1)
StartupWithWebSocket.cs (1)
31using var ws = await context.WebSockets.AcceptWebSocketAsync();
InProcessWebSite (9)
src\Servers\IIS\IIS\test\testassets\InProcessWebSite\Startup.WebSockets.cs (9)
52var ws = await Upgrade(context); 63var ws = await Upgrade(context); 87var ws = await Upgrade(context); 134private static async Task SendMessages(WebSocket webSocket, params string[] messages) 142private static async Task<WebSocket> Upgrade(HttpContext context) 159var ws = WebSocket.CreateFromStream(opaqueTransport, isServer: true, subProtocol: null, keepAliveInterval: TimeSpan.FromMinutes(2)); 163private async Task Echo(WebSocket webSocket, CancellationToken token) 197private async Task CloseWebSocket(WebSocket webSocket, bool receivedClose)
Interop.FunctionalTests (2)
Http2WebSocketInteropTests.cs (2)
63var ws = await context.WebSockets.AcceptWebSocketAsync(); 116var ws = await context.WebSockets.AcceptWebSocketAsync();
Microsoft.AspNetCore.Components.Server (2)
DependencyInjection\ServerRazorComponentsBuilderExtensions.cs (2)
170public Task<WebSocket> AcceptAsync(WebSocketAcceptContext context) 191private async Task<WebSocket> ReturnAwaited(Task result, WebSocketAcceptContext context)
Microsoft.AspNetCore.Http (2)
Internal\DefaultWebSocketManager.cs (2)
61public override Task<WebSocket> AcceptWebSocketAsync(string? subProtocol) 68public override Task<WebSocket> AcceptWebSocketAsync(WebSocketAcceptContext acceptContext)
Microsoft.AspNetCore.Http.Abstractions (3)
WebSocketManager.cs (3)
30public virtual Task<WebSocket> AcceptWebSocketAsync() 40public abstract Task<WebSocket> AcceptWebSocketAsync(string? subProtocol); 47public virtual Task<WebSocket> AcceptWebSocketAsync(WebSocketAcceptContext acceptContext) => throw new NotImplementedException();
Microsoft.AspNetCore.Http.Connections (7)
Internal\Transports\WebSocketsServerTransport.cs (5)
43using (var ws = await context.WebSockets.AcceptWebSocketAsync(subProtocol)) 60public async Task ProcessSocketAsync(WebSocket socket) 131private async Task StartReceiving(WebSocket socket) 200private async Task StartSending(WebSocket socket, bool ignoreFirstCancel) 301private static bool WebSocketCanSend(WebSocket ws)
src\SignalR\common\Shared\WebSocketExtensions.cs (2)
14public static ValueTask SendAsync(this WebSocket webSocket, ReadOnlySequence<byte> buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default) 39private static async ValueTask SendMultiSegmentAsync(WebSocket webSocket, ReadOnlySequence<byte> buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default)
Microsoft.AspNetCore.Http.Connections.Client (10)
HttpConnectionOptions.cs (2)
68/// Gets or sets a delegate for wrapping or replacing the <see cref="WebSocket"/> 71public Func<WebSocketConnectionContext, CancellationToken, ValueTask<WebSocket>>? WebSocketFactory { get; set; }
Internal\WebSocketsTransport.cs (6)
32private WebSocket? _webSocket; 90private async ValueTask<WebSocket> DefaultWebSocketFactory(WebSocketConnectionContext context, CancellationToken cancellationToken) 337private async Task ProcessSocketAsync(WebSocket socket, Uri url, bool isReconnect) 433private async Task StartReceiving(WebSocket socket) 530private async Task StartSending(WebSocket socket, bool ignoreFirstCanceled) 633private static bool WebSocketCanSend(WebSocket ws)
src\SignalR\common\Shared\WebSocketExtensions.cs (2)
14public static ValueTask SendAsync(this WebSocket webSocket, ReadOnlySequence<byte> buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default) 39private static async ValueTask SendMultiSegmentAsync(WebSocket webSocket, ReadOnlySequence<byte> buffer, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken = default)
Microsoft.AspNetCore.Http.Connections.Tests (8)
TestWebSocketConnectionFeature.cs (3)
36public Task<WebSocket> AcceptAsync() => AcceptAsync(new WebSocketAcceptContext()); 38public Task<WebSocket> AcceptAsync(WebSocketAcceptContext context) 50return Task.FromResult<WebSocket>(serverSocket);
WebSocketsTests.cs (5)
217var serverSocket = await feature.AcceptAsync(); 251var serverSocket = await feature.AcceptAsync(); 286var serverSocket = await feature.AcceptAsync(); 325var serverSocket = await feature.AcceptAsync(); 403var serverSocket = await feature.AcceptAsync();
Microsoft.AspNetCore.Http.Features (3)
IHttpWebSocketFeature.cs (3)
19/// Attempts to upgrade the request to a <see cref="WebSocket"/>. Check <see cref="IsWebSocketRequest"/> 23/// <returns>A <see cref="WebSocket"/>.</returns> 24Task<WebSocket> AcceptAsync(WebSocketAcceptContext context);
Microsoft.AspNetCore.Http.Tests (1)
DefaultHttpContextTests.cs (1)
504public Task<WebSocket> AcceptAsync(WebSocketAcceptContext context)
Microsoft.AspNetCore.Owin (12)
OwinEnvironment.cs (1)
23Task<WebSocket>
OwinFeatureCollection.cs (2)
311Task<WebSocket> IHttpWebSocketFeature.AcceptAsync(WebSocketAcceptContext context) 318var accept = (Func<WebSocketAcceptContext, Task<WebSocket>>)obj;
WebSockets\OwinWebSocketAcceptAdapter.cs (4)
24Task<WebSocket> 35private readonly TaskCompletionSource<WebSocket> _acceptTcs = new TaskCompletionSource<WebSocket>(); 48private async Task<WebSocket> AcceptWebSocketAsync(WebSocketAcceptContext context)
WebSockets\WebSocketAcceptAdapter.cs (2)
24Task<WebSocket> 85var webSocket = await adapter._accept(acceptContext);
WebSockets\WebSocketAdapter.cs (3)
36private readonly WebSocket _webSocket; 40internal WebSocketAdapter(WebSocket webSocket, CancellationToken ct) 52_environment[typeof(WebSocket).FullName] = webSocket;
Microsoft.AspNetCore.SignalR.Client.Tests (4)
HttpConnectionFactoryTests.cs (2)
81Func<WebSocketConnectionContext, CancellationToken, ValueTask<WebSocket>> webSocketFactory = (context, token) => ValueTask.FromResult<WebSocket>(null);
HubConnectionTests.cs (1)
778return ValueTask.FromResult<WebSocket>(null);
WebSocketsTransportTests.cs (1)
23return ValueTask.FromResult((WebSocket)new TestWebSocket());
Microsoft.AspNetCore.SignalR.Tests (1)
WebSocketsTransportTests.cs (1)
66var webSocketMock = new Mock<WebSocket>();
Microsoft.AspNetCore.SpaServices.Extensions (3)
Proxying\SpaProxy.cs (3)
260using (var server = await context.WebSockets.AcceptWebSocketAsync(client.SubProtocol)) 272private static async Task PumpWebSocket(WebSocket source, WebSocket destination, int bufferSize, CancellationToken cancellationToken)
Microsoft.AspNetCore.TestHost (4)
WebSocketClient.cs (4)
54public async Task<WebSocket> ConnectAsync(Uri uri, CancellationToken cancellationToken) 131public WebSocket? ClientWebSocket { get; private set; } 133public WebSocket? ServerWebSocket { get; private set; } 135async Task<WebSocket> IHttpWebSocketFeature.AcceptAsync(WebSocketAcceptContext context)
Microsoft.AspNetCore.TestHost.Tests (13)
TestClientTests.cs (10)
583var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 615var clientSocket = await client.ConnectAsync(new System.Uri("http://localhost"), CancellationToken.None); 657var websocket = await ctx.WebSockets.AcceptWebSocketAsync("charlie"); 666var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 682var clientSocket = await client.ConnectAsync(new Uri("wss://localhost"), CancellationToken.None); 705var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 762var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 774var clientSocket = await client.ConnectAsync(new System.Uri("http://localhost"), CancellationToken.None); 789var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 807var clientSocket = await client.ConnectAsync(new System.Uri("http://localhost"), CancellationToken.None);
WebSocketClientTests.cs (3)
69using var websocket = await ctx.WebSockets.AcceptWebSocketAsync(); 81using var socket = await client.ConnectAsync( 117using var socket = await client.ConnectAsync(
Microsoft.AspNetCore.WebSockets (5)
AbortStream.cs (2)
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. 25public WebSocket? WebSocket { get; set; }
WebSocketMiddleware.cs (3)
132public async Task<WebSocket> AcceptAsync(WebSocketAcceptContext acceptContext) 214var wrappedSocket = WebSocket.CreateFromStream(abortStream, new WebSocketCreationOptions()
Microsoft.AspNetCore.WebSockets.Tests (32)
WebSocketCompressionMiddlewareTests.cs (4)
21var webSocket = await context.WebSockets.AcceptWebSocketAsync(new WebSocketAcceptContext() 53var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 83var webSocket = await context.WebSockets.AcceptWebSocketAsync(new WebSocketAcceptContext() 116using var webSocket = await context.WebSockets.AcceptWebSocketAsync(new WebSocketAcceptContext()
WebSocketMiddlewareTests.cs (22)
24var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 41var webSocket = await context.WebSockets.AcceptWebSocketAsync("Bravo"); 68var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 93var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 118var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 144var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 175var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 224var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 249var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 274var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 307var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 350var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 378var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 406var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 436var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 468var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 504WebSocket serverSocket = null; 582WebSocket serverSocket = null; 725var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 746var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 786var webSocket = await context.WebSockets.AcceptWebSocketAsync(); 807var webSocket = await context.WebSockets.AcceptWebSocketAsync();
WebSocketPair.cs (6)
10public WebSocket ClientSocket { get; } 11public WebSocket ServerSocket { get; } 15public WebSocketPair(DuplexStream serverStream, DuplexStream clientStream, WebSocket clientSocket, WebSocket serverSocket) 32clientSocket: WebSocket.CreateFromStream(clientStream, isServer: false, subProtocol: null, keepAliveInterval: TimeSpan.FromMinutes(2)), 33serverSocket: WebSocket.CreateFromStream(serverStream, isServer: true, subProtocol: null, keepAliveInterval: TimeSpan.FromMinutes(2)));
netstandard (1)
netstandard.cs (1)
1312[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.WebSockets.WebSocket))]
System (1)
src\libraries\shims\System\ref\System.cs (1)
803[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Net.WebSockets.WebSocket))]
System.Net.HttpListener (6)
System\Net\HttpListenerContext.cs (1)
27return AcceptWebSocketAsync(subProtocol, HttpWebSocket.DefaultReceiveBufferSize, WebSocket.DefaultKeepAliveInterval);
System\Net\Managed\WebSockets\HttpWebSocket.Managed.cs (2)
59WebSocket webSocket = WebSocket.CreateFromStream(context.Connection.ConnectedStream, isServer: true, subProtocol, keepAliveInterval);
System\Net\WebSockets\HttpListenerWebSocketContext.cs (3)
26private readonly WebSocket _webSocket; 40WebSocket webSocket) 87public override WebSocket WebSocket => _webSocket;
System.Net.WebSockets (18)
System\Net\WebSockets\ValueWebSocketReceiveResult.cs (2)
8/// <summary>Represents the result of performing a single <see cref="WebSocket.ReceiveAsync(Memory{byte}, System.Threading.CancellationToken)"/> operation on a <see cref="WebSocket"/>.</summary>
System\Net\WebSockets\WebSocket.cs (6)
126/// <summary>Creates a <see cref="WebSocket"/> that operates on a <see cref="Stream"/> representing a web socket connection.</summary> 131/// <returns>The created <see cref="WebSocket"/>.</returns> 132public static WebSocket CreateFromStream(Stream stream, bool isServer, string? subProtocol, TimeSpan keepAliveInterval) 156/// <summary>Creates a <see cref="WebSocket"/> that operates on a <see cref="Stream"/> representing a web socket connection.</summary> 159public static WebSocket CreateFromStream(Stream stream, WebSocketCreationOptions options) 184public static WebSocket CreateClientWebSocket(Stream innerStream,
System\Net\WebSockets\WebSocketContext.cs (1)
23public abstract WebSocket WebSocket { get; }
System\Net\WebSockets\WebSocketCreationOptions.cs (1)
9/// Options that control how a <seealso cref="WebSocket"/> is created.
System\Net\WebSockets\WebSocketDeflateOptions.cs (1)
7/// Options to enable per-message deflate compression for <seealso cref="WebSocket" />.
System\Net\WebSockets\WebSocketException.cs (4)
134$"{nameof(WebSocket)}.{nameof(WebSocket.CloseAsync)}", 135$"{nameof(WebSocket)}.{nameof(WebSocket.CloseOutputAsync)}"),
System\Net\WebSockets\WebSocketMessageFlags.cs (2)
7/// Flags for controlling how the <see cref="WebSocket"/> should send a message. 23/// Disables compression for the message if compression has been enabled for the <see cref="WebSocket"/> instance.
System\Net\WebSockets\WebSocketStateHelper.cs (1)
40ObjectDisposedException.ThrowIf(isDisposed, typeof(WebSocket));
System.Net.WebSockets.Client (5)
System\Net\WebSockets\ClientWebSocket.cs (1)
166private WebSocket ConnectedWebSocket
System\Net\WebSockets\ClientWebSocketOptions.cs (2)
179/// The default is <see cref="WebSocket.DefaultKeepAliveInterval"/> (typically 30 seconds). 223/// supports per-message-deflate and the options are accepted, the <see cref="WebSocket"/> instance
System\Net\WebSockets\WebSocketHandle.Managed.cs (2)
29public WebSocket? WebSocket { get; private set; } 196WebSocket = WebSocket.CreateFromStream(connectedStream, new WebSocketCreationOptions