No results for ""

Powered byAlgolia


Socket is a WebSocket client to interact with a WebSocket connection. You can use it to listen various events happening on the WebSocket connection and send messages to the server. Additionally, you can use socket.setTimeout() and socket.setInterval() to execute code in the background, or repeatedly, while the WebSocket connection is open.

Method Description
Socket.close() Close the WebSocket connection.
Socket.on(event, callback) Set up an event listener on the connection for any of the following events:
- open
- message
- ping
- pong
- close
- error. Send a ping.
Socket.send(data) Send data.
Socket.setInterval(callback, interval) Call a function repeatedly at certain intervals, while the connection is open.
Socket.setTimeout(callback, period) Call a function with a delay, if the connection is open.