84 string p =
string.Empty;
85 if (validStates !=
null && validStates.Length != 0)
89 if (
state == webSocketState)
94 p =
string.Join(
", ", validStates);
110 if (receiveBufferSize <= 0)
114 if (sendBufferSize <= 0)
123 if (receiveBufferSize <= 0)
140 if (subProtocol !=
null)
169 [Obsolete(
"This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.")]
176 [Obsolete(
"This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.")]
185 if (innerStream ==
null)
193 if (subProtocol !=
null)
201 if (receiveBufferSize <= 0 || sendBufferSize <= 0)
205 return new ManagedWebSocket(innerStream, isServer:
false, subProtocol, keepAliveInterval);
static ArrayPool< T > Shared
static byte Max(byte val1, byte val2)
WebSocketMessageType MessageType
static void ValidateSubprotocol(string subProtocol)
static bool IsStateTerminal(WebSocketState state)
string? CloseStatusDescription
async ValueTask SendWithArrayPoolAsync(ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
static ArraySegment< byte > CreateClientBuffer(int receiveBufferSize, int sendBufferSize)
virtual ValueTask SendAsync(ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, WebSocketMessageFlags messageFlags, CancellationToken cancellationToken=default(CancellationToken))
static bool IsApplicationTargeting45()
static ArraySegment< byte > CreateServerBuffer(int receiveBufferSize)
virtual async ValueTask< ValueWebSocketReceiveResult > ReceiveAsync(Memory< byte > buffer, CancellationToken cancellationToken)
Task< WebSocketReceiveResult > ReceiveAsync(ArraySegment< byte > buffer, CancellationToken cancellationToken)
static WebSocket CreateClientWebSocket(Stream innerStream, string? subProtocol, int receiveBufferSize, int sendBufferSize, TimeSpan keepAliveInterval, bool useZeroMaskingKey, ArraySegment< byte > internalBuffer)
Task CloseOutputAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
virtual ValueTask SendAsync(ReadOnlyMemory< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
Task SendAsync(ArraySegment< byte > buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
WebSocketCloseStatus? CloseStatus
Task CloseAsync(WebSocketCloseStatus closeStatus, string? statusDescription, CancellationToken cancellationToken)
static void ThrowOnInvalidState(WebSocketState state, params WebSocketState[] validStates)
static WebSocket CreateFromStream(Stream stream, bool isServer, string? subProtocol, TimeSpan keepAliveInterval)
static void RegisterPrefixes()
static WebSocket CreateFromStream(Stream stream, WebSocketCreationOptions options)
static TimeSpan DefaultKeepAliveInterval
static string NotWriteableStream
static string Format(string resourceFormat, object p1)
static string net_WebSockets_ArgumentOutOfRange_TooSmall
static string net_WebSockets_InvalidState
static string NotReadableStream
new ConfiguredTaskAwaitable< TResult > ConfigureAwait(bool continueOnCapturedContext)
static readonly TimeSpan InfiniteTimeSpan
void CopyTo(Span< T > destination)
static TimeSpan FromSeconds(double value)
static readonly TimeSpan Zero