UCE Docs / ws_send_to

Signature

bool ws_send_to(String connection_id, String message, bool binary = false)

Parameters

connection_id : ID of the target WebSocket client
message : message payload to send
binary : set to true to send a binary frame instead of a text frame
return value : true if the target connection exists and the message was queued

Queues a WebSocket message for one specific connected client.

Example

bool sent = ws_send_to("example-connection-id", "direct message");
print(sent ? "message queued" : "no such connection", "\n");
Output
message queued