WebSocketClient.CloseStatus
property · WebSocketClient · cAlgo.API
DesktopCLICloud
Gets close status / reason.
Environment behaviour
Cloud — works differently. Connects only to port 25345, and only on production cloud servers. Other ports fail to connect.
Definition
public WebSocketClientCloseStatus? CloseStatus {get;}
webSocketClient.CloseStatus: WebSocketClientCloseStatus | None
Returns WebSocketClientCloseStatus?
Examples
var client = new WebSocketClient();
client.Disconnected += args =>
{
if (args.Client.CloseStatus.HasValue)
Print("Connection closed with status {0}", args.Client.CloseStatus.Value);
};
client.Connect(new Uri("wss://stream.example.com/quotes"));
from System import Uri
client = WebSocketClient()
client.Disconnected += lambda args: api.Print(f"Connection closed with status {args.Client.CloseStatus}")
client.Connect(Uri("wss://stream.example.com/quotes"))