WebSocketClientBinaryReceivedEventArgs.Data
property · WebSocketClientBinaryReceivedEventArgs · cAlgo.API
DesktopCLICloud
Received data.
Environment behaviour
Cloud — not supported. Never raised in the cloud: the events that pass it never fire there (WebSocketClient.BinaryReceived).
Definition
public byte[] Data {get;}
webSocketClientBinaryReceivedEventArgs.Data: list[int]
Returns byte[]
Examples
private WebSocketClient _client = new WebSocketClient();
protected override void OnStart()
{
_client.BinaryReceived += OnBinaryReceived;
_client.Connect(new Uri("wss://example.com/stream"));
}
private void OnBinaryReceived(WebSocketClientBinaryReceivedEventArgs args)
{
var message = Encoding.UTF8.GetString(args.Data);
Print("Decoded message: {0}", message);
}
from System import Uri
def on_start(self):
self.client = WebSocketClient()
self.client.BinaryReceived += self.on_binary_received
self.client.Connect(Uri("wss://example.com/stream"))
def on_binary_received(self, args):
message = bytes(args.Data).decode("utf-8")
api.Print(f"Decoded message: {message}")