C# Class System.Net.WebSockets.WebSocketHandle

Mostra file Open project: dotnet/corefx Class Usage Examples

Public Methods

Method Description
Abort ( ) : void
CheckPlatformSupport ( ) : void
CloseAsync ( WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken ) : Task
CloseOutputAsync ( WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken ) : Task
ConnectAsyncCore ( Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options ) : Task
Create ( ) : WebSocketHandle
Dispose ( ) : void
IsValid ( WebSocketHandle handle ) : bool
ReceiveAsync ( ArraySegment buffer, CancellationToken cancellationToken ) : Task
SendAsync ( ArraySegment buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken ) : Task

Private Methods

Method Description
BuildRequestHeader ( Uri uri, ClientWebSocketOptions options, string secKey ) : byte[]

Creates a byte[] containing the headers to send to the server.

ConnectSocketAsync ( string host, int port, CancellationToken cancellationToken ) : Task

Connects a socket to the specified host and port, subject to cancellation and aborting.

CreateSecKeyAndSecWebSocketAccept ( ) : string>.KeyValuePair
ParseAndValidateConnectResponseAsync ( System.Stream stream, ClientWebSocketOptions options, string expectedSecWebSocketAccept, CancellationToken cancellationToken ) : Task

Read and validate the connect response headers from the server.

ReadResponseHeaderLineAsync ( System.Stream stream, CancellationToken cancellationToken ) : Task

Reads a line from the stream.

ValidateAndTrackHeader ( string targetHeaderName, string targetHeaderValue, string foundHeaderName, string foundHeaderValue, bool &foundHeader ) : void

Validates a received header against expected values and tracks that we've received it.

WebSocketHandle ( System.Net.WebSockets.WinHttpWebSocket webSocket ) : System
WebSocketHandle ( System.Net.WebSockets.WinRTWebSocket webSocket ) : System

Method Details

Abort() public method

public Abort ( ) : void
return void

CheckPlatformSupport() public static method

public static CheckPlatformSupport ( ) : void
return void

CloseAsync() public method

public CloseAsync ( WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken ) : Task
closeStatus WebSocketCloseStatus
statusDescription string
cancellationToken System.Threading.CancellationToken
return Task

CloseOutputAsync() public method

public CloseOutputAsync ( WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken ) : Task
closeStatus WebSocketCloseStatus
statusDescription string
cancellationToken System.Threading.CancellationToken
return Task

ConnectAsyncCore() public method

public ConnectAsyncCore ( Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options ) : Task
uri System.Uri
cancellationToken System.Threading.CancellationToken
options ClientWebSocketOptions
return Task

Create() public static method

public static Create ( ) : WebSocketHandle
return WebSocketHandle

Dispose() public method

public Dispose ( ) : void
return void

IsValid() public static method

public static IsValid ( WebSocketHandle handle ) : bool
handle WebSocketHandle
return bool

ReceiveAsync() public method

public ReceiveAsync ( ArraySegment buffer, CancellationToken cancellationToken ) : Task
buffer ArraySegment
cancellationToken System.Threading.CancellationToken
return Task

SendAsync() public method

public SendAsync ( ArraySegment buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken ) : Task
buffer ArraySegment
messageType WebSocketMessageType
endOfMessage bool
cancellationToken System.Threading.CancellationToken
return Task