Skip to content

WebSocketClient

Summary

Represents a web socket client.

Signature

1
public class WebSocketClient

Namespace

cAlgo.API

Methods

Connect

Summary

Connects WebSocketClient to passed URI.

Signature

1
public void Connect(Uri uri)

Parameters

Name Type Description
uri Uri The server URI.

Return Value

void

Close

Summary

Gets close status / reason.

Signature

1
public void Close(WebSocketClientCloseStatus closeStatus, string closeStatusDescription)

Parameters

Name Type Description
closeStatus WebSocketClientCloseStatus
closeStatusDescription string

Return Value

void

Send (2)

Send (1 of 2)

Summary

Sends passed text.

Signature

1
public void Send(string text)

Parameters

Name Type Description
text string Text to send.

Return Value

void

Send (2 of 2)

Summary

Sends passed binary data.

Signature

1
public void Send(byte[] data)

Parameters

Name Type Description
data byte[] Data to send.

Return Value

void

Dispose

Summary

Releases the unmanaged resources used by the WebSocketClient instance.

Signature

1
public void Dispose()

Return Value

void

Properties

State

Summary

Gets current state of WebSocketClient instance.

Signature

1
public WebSocketClientState State {get;}

Return Value

WebSocketClientState

CloseStatus

Summary

Gets close status / reason.

Signature

1
public WebSocketClientCloseStatus? CloseStatus {get;}

Return Value

WebSocketClientCloseStatus?

CloseStatusDescription

Summary

Gets a description of the reason why the instance was closed.

Signature

1
public string CloseStatusDescription {get;}

Return Value

string

Events

Connected

Summary

Occurs when WebSocketClient is connected.

Signature

1
public event Action<WebSocketClientConnectedEventArgs> Connected;

Disconnected

Summary

Occurs when WebSocketClient is disconnected.

Signature

1
public event Action<WebSocketClientDisconnectEventArgs> Disconnected;

TextReceived

Summary

Occurs when WebSocketClient receives text data.

Signature

1
public event Action<WebSocketClientTextReceivedEventArgs> TextReceived;

BinaryReceived

Summary

Occurs when WebSocketClient receives binary data.

Signature

1
public event Action<WebSocketClientBinaryReceivedEventArgs> BinaryReceived;