Class: WebsocketClient
A websocket client
Static Methods
WebsocketClient WebsocketClient.new(url_connection_string: string)
Properties
string Url [readonly]
Methods
void WebsocketClient:Disconnect() [yields]
Disconnects the websocket. Yields until the client is fully disconnected.
void WebsocketClient:Connect(connection_info: table) [yields]
Connects the websocket. connection_info
may contain the following:
Header | Description | Default |
---|---|---|
Headers | A map of header names to header values. | {} |
Cookies | A map of cookie names to cookie values. | {} |
In addition to any user-specified headers, Synapse X will add Syn-Signature
, Syn-Fingerprint
, and Syn-User-Identifier
as specified here.
void WebsocketClient:Send(message: string, is_binary?: bool = False)
Sends a payload.
Events
WebsocketClient.DataReceived(payload: string, is_binary: bool)
Fires when data is received.
WebsocketClient.ConnectionClosed()
Fires when the connection is closed. Can be for reasons other than :Disconnect(); i.e. on a sudden loss of connection.