IWebSocket IWebSocket IWebSocket IWebSocket Interface

Definition

Provides access to network communication that allows reading and writing using a WebSocket.

public : interface IWebSocketpublic interface IWebSocketPublic Interface IWebSocket// You can use this interface in JavaScript.
Inheritance
IClosableIDisposableIDisposableIDisposable
IWebSocketIWebSocketIWebSocketIWebSocket
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited methods

Properties

OutputStream OutputStream OutputStream OutputStream

Gets the output stream to write to the remote network destination on a IWebSocket object.

public : IOutputStream OutputStream { get; }public IOutputStream OutputStream { get; }Public ReadOnly Property OutputStream As IOutputStream// You can use this property in JavaScript.
Value
IOutputStream IOutputStream IOutputStream IOutputStream

A sequential stream of bytes to be written to the remote destination.

Remarks

This property is used with the DataWriter object to write outgoing data to be sent to the remote network destination on a socket object.

Methods

Close(UInt16, String) Close(UInt16, String) Close(UInt16, String) Close(UInt16, String)

Closes the IWebSocket.

public : void Close(unsigned short code, PlatForm::String reason)public void Close(UInt16 code, String reason)Public Function Close(code As UInt16, reason As String) As void// You can use this method in JavaScript.
Parameters
code
unsigned short UInt16 UInt16 UInt16

Status code indicating the reason for closure.

reason
PlatForm::String String String String

Optional UTF-8-encoded data with additional information about the closure.

ConnectAsync(Uri) ConnectAsync(Uri) ConnectAsync(Uri) ConnectAsync(Uri)

Starts an asynchronous operation to connect to a remote network destination on a IWebSocket object.

public : IAsyncAction ConnectAsync(Uri uri)public IAsyncAction ConnectAsync(Uri uri)Public Function ConnectAsync(uri As Uri) As IAsyncAction// You can use this method in JavaScript.
Parameters
uri
Uri Uri Uri Uri

An absolute Uri for the server to connect to.

Returns

An asynchronous connect operation on a IWebSocket object.

See Also
UriUriUriUri

SetRequestHeader(String, String) SetRequestHeader(String, String) SetRequestHeader(String, String) SetRequestHeader(String, String)

Adds an HTTP request header to the HTTP request message used in the WebSocket protocol handshake by the IWebSocket object.

public : void SetRequestHeader(PlatForm::String headerName, PlatForm::String headerValue)public void SetRequestHeader(String headerName, String headerValue)Public Function SetRequestHeader(headerName As String, headerValue As String) As void// You can use this method in JavaScript.
Parameters
headerName
PlatForm::String String String String

The name of the request header.

headerValue
PlatForm::String String String String

The value of the request header.

Events

Closed Closed Closed Closed

Occurs when a close frame is received on the IWebSocket object as part of the close handshake.

public : abstract event TypedEventHandler Closed<IWebSocket,  WebSocketClosedEventArgs>public abstract event TypedEventHandler Closed<IWebSocket,  WebSocketClosedEventArgs>Public MustInherit Event Closed<IWebSocket,  WebSocketClosedEventArgs>// You can use this event in JavaScript.

See Also

  • IClosable IDisposable IDisposable IDisposable