WebSocketClient¶
WebSocketClient provides methods to communicate with the server.
Methods¶
getRequestID¶
handle:getRequestID()
Get the ID of the request.
Returns¶
requestId
: integer - ID of the request.
send¶
handle:send( data )
Send data to the WebSocket server.
Parameters¶
data
: string - Data to transmit
Throws¶
- If connection is closed
closeAsync¶
handle:closeAsync()
Close the connection.
Emits¶
websocket_close¶
websocket_close
: string - Event name.requestId
: integer - ID of the request.
receive¶
handle:receive()
Await data to receive
Extension
This function is an extension implemented by CapyOS!
Returns¶
data
: string - Data received.
Throws¶
- If connection is closed
close¶
handle:close()
Close the connection.
Extension
This function is an extension implemented by CapyOS!
Last update:
March 11, 2023
Created: March 11, 2023
Created: March 11, 2023