WebSocketClientConnectedEventArgs.Client
property · WebSocketClientConnectedEventArgs · cAlgo.API
DesktopCLICloud
Connected websocket client instance.
Environment behaviour
Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (WebSocketClient.Connected).
Definition
public WebSocketClient Client {get;}
webSocketClientConnectedEventArgs.Client: WebSocketClient
Returns WebSocketClient
Examples
private WebSocketClient _client = new WebSocketClient();
protected override void OnStart()
{
_client.Connected += OnConnected;
_client.Connect(new Uri("wss://example.com/stream"));
}
private void OnConnected(WebSocketClientConnectedEventArgs args)
{
args.Client.Send("{\"action\": \"subscribe\", \"symbol\": \"EURUSD\"}");
}
from System import Uri
def on_start(self):
self.client = WebSocketClient()
self.client.Connected += self.on_connected
self.client.Connect(Uri("wss://example.com/stream"))
def on_connected(self, args):
args.Client.Send('{"action": "subscribe", "symbol": "EURUSD"}')