Edit

Share via


WebSocketStream.Create Method

Definition

Overloads

Create(WebSocket, WebSocketMessageType, Boolean)

Creates a WebSocketStream that delegates to a wrapped WebSocket.

public static System.Net.WebSockets.WebSocketStream Create(System.Net.WebSockets.WebSocket webSocket, System.Net.WebSockets.WebSocketMessageType writeMessageType, bool ownsWebSocket = false);
static member Create : System.Net.WebSockets.WebSocket * System.Net.WebSockets.WebSocketMessageType * bool -> System.Net.WebSockets.WebSocketStream
Public Shared Function Create (webSocket As WebSocket, writeMessageType As WebSocketMessageType, Optional ownsWebSocket As Boolean = false) As WebSocketStream

Parameters

webSocket
WebSocket

The wrapped WebSocket.

writeMessageType
WebSocketMessageType

The type of messages that should be written as part of WriteAsync calls. Each write produces a message.

ownsWebSocket
Boolean

true if disposing the Stream should close the underlying WebSocket; otherwise, false. Defaults to false.

Returns

A new instance of WebSocketStream that forwards reads and writes on the Stream to the underlying WebSocket.

Applies to

Create(WebSocket, WebSocketMessageType, TimeSpan)

Creates a WebSocketStream that delegates to a wrapped WebSocket.

public:
 static System::Net::WebSockets::WebSocketStream ^ Create(System::Net::WebSockets::WebSocket ^ webSocket, System::Net::WebSockets::WebSocketMessageType writeMessageType, TimeSpan closeTimeout);
public static System.Net.WebSockets.WebSocketStream Create(System.Net.WebSockets.WebSocket webSocket, System.Net.WebSockets.WebSocketMessageType writeMessageType, TimeSpan closeTimeout);
static member Create : System.Net.WebSockets.WebSocket * System.Net.WebSockets.WebSocketMessageType * TimeSpan -> System.Net.WebSockets.WebSocketStream
Public Shared Function Create (webSocket As WebSocket, writeMessageType As WebSocketMessageType, closeTimeout As TimeSpan) As WebSocketStream

Parameters

webSocket
WebSocket

The wrapped WebSocket.

writeMessageType
WebSocketMessageType

The type of messages that should be written as part of WriteAsync calls. Each write produces a message.

closeTimeout
TimeSpan

The amount of time that disposing the WebSocketStream will wait for a graceful closing of the WebSocket's output.

Returns

A new instance of WebSocketStream that forwards reads and writes on the Stream to the underlying WebSocket.

Applies to