WebSocket.CreateFromStream(Stream, Boolean, String, TimeSpan) 方法

定義

建立新的 WebSocket 物件,其會在指定的資料流上運作,表示 Web 通訊端連線。Creates a new WebSocket object that operates on the specified stream, which represents a web socket connection.

public:
 static System::Net::WebSockets::WebSocket ^ CreateFromStream(System::IO::Stream ^ stream, bool isServer, System::String ^ subProtocol, TimeSpan keepAliveInterval);
public static System.Net.WebSockets.WebSocket CreateFromStream (System.IO.Stream stream, bool isServer, string subProtocol, TimeSpan keepAliveInterval);
static member CreateFromStream : System.IO.Stream * bool * string * TimeSpan -> System.Net.WebSockets.WebSocket

參數

stream
Stream

連線的資料流。The stream for the connection.

isServer
Boolean

true 表示其為連接的伺服器端;如果是用戶端,則為 falsetrue to indicate it's the server-side of the connection; false if it's the client-side.

subProtocol
String

建立連線時所使用的已同意子通訊協定。The agreed upon sub-protocol that was used when creating the connection.

keepAliveInterval
TimeSpan

要使用的持續連線間隔,或 InfiniteTimeSpan 以停用持續連線。The keep-alive interval to use, or InfiniteTimeSpan to disable keep-alives.

傳回

新的 Web 通訊端。The new web socket.

適用於