Client: Caller
Represents a WebSocket caller.
Remote Methods
writeTextMessage | Pushes text messages to the connection. |
writeBinaryMessage | Pushes binary data to the connection. |
ping | Pings the connection. |
pong | Sends a pong message to the connection. |
close | Closes the connection. |
Methods
setAttribute | Sets a connection related attribute. |
getAttribute | Gets connection related attribute if any. |
removeAttribute | Removes connection related attribute if any. |
getConnectionId | Gives the connection id associated with this connection. |
getNegotiatedSubProtocol | Gives the subprotocol if any that is negotiated with the client. |
isSecure | Gives the secured status of the connection. |
isOpen | Gives the open or closed status of the connection. |
writeTextMessage
Pushes text messages to the connection. If an error occurs while sending the text message to the connection, that message will be lost.
Parameters
- data string
Data to be sent
writeBinaryMessage
function writeBinaryMessage(byte[ ] data) returns Error?
Pushes binary data to the connection. If an error occurs while sending the binary message to the connection, that message will be lost.
Parameters
- data byte[ ]
Binary data to be sent
ping
function ping(byte[ ] data) returns Error?
Pings the connection. If an error occurs while sending the ping frame to the server, that frame will be lost.
Parameters
- data byte[ ]
Binary data to be sent
pong
function pong(byte[ ] data) returns Error?
Sends a pong message to the connection. If an error occurs while sending the pong frame to the connection, that the frame will be lost.
Parameters
- data byte[ ]
Binary data to be sent
close
Closes the connection.
Parameters
- statusCode int? (default 1000)
Status code for closing the connection
- reason string? (default ())
Reason for closing the connection
- timeout decimal (default 60)
Time to wait (in seconds) for the close frame to be received from the remote endpoint before closing the connection. If the timeout exceeds, then the connection is terminated even though a close frame is not received from the remote endpoint. If the value < 0 (e.g., -1), then the connection waits until a close frame is received. If the WebSocket frame is received from the remote endpoint within the waiting period, the connection is terminated immediately