WebSocketClient.CloseStatus
property · WebSocketClient · cAlgo.API
DesktopCLICloud
Gets close status / reason.
Environment behaviour
Cloud — not supported. Connect, Send and Close do nothing: "WebSocket is not supported in cloud environment." is written to the log, State stays None and no events are raised.
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"))