Clients -
http :
WebSocketClient
Represents a WebSocket client endpoint.
Constructor
__init
(string url, WebSocketClientEndpointConfig? config)
- url string
- config WebSocketClientEndpointConfig? ()
Remote Methods
Push text to the connection.
Push binary data to the connection.
Ping the connection.
Send pong message to the connection.
Close the connection.
Called when the endpoint is ready to receive messages. Can be called only once per endpoint. For the WebSocketListener can be called only in upgrade or onOpen resources.
Methods
Fields
- id string
-
The connection id
- negotiatedSubProtocol string
-
The subprotocols that are negotiated with the server
- isSecure boolean false
-
true
if the connection is secure
- isOpen boolean false
-
true
if the connection is open
- response Response BLangTypeInit: new null ([])
-
Represents the HTTP response
- attributes map {}
-
A map to store connection related attributes
pushText
(string | json | xml | boolean | int | float | byte | byte[] data, boolean finalFrame)
returns error?Push text to the connection.
-
Return Type
(error?) error
if an error occurs when sending
Push binary data to the connection.
Parameters
- data byte[]
-
Binary data to be sent
- finalFrame boolean - true
-
Set to
true
if this is a final frame of a (long) message
-
Return Type
(error?) error
if an error occurs when sending
Ping the connection.
Parameters
- data byte[]
-
Binary data to be sent.
-
Return Type
(error?) error
if an error occurs when sending
Send pong message to the connection.
Parameters
- data byte[]
-
Binary data to be sent
-
Return Type
(error?) error
if an error occurs when sending
Close the connection.
Parameters
- statusCode int? - 1000
-
Status code for closing the connection
- reason string? - ()
-
Reason for closing the connection
- timeoutInSecs int - 60
-
Time to wait 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 WebSocket frame is received from the remote endpoint, within waiting period the connection is terminated immediately.
-
Return Type
(error?) error
if an error occurs when sending
Called when the endpoint is ready to receive messages. Can be called only once per endpoint. For the WebSocketListener can be called only in upgrade or onOpen resources.
-
Return Type
(error?) error
if an error occurs when sending