socket.io to emit real-time events, leveraging WebSocket technology. This makes integration development more efficient and straightforward for developers. WebSocket provides a full-duplex communication channel over a single, long-lived connection, allowing real-time data flow between client and server.
To enable WebSockets, set the environment variable
WEBSOCKET_ENABLED to true. See more details in Environment Variables.WebSocket Operation Modes
The WebSocket can only be connected after executing theset command on the instance. This allows the WebSocket to be specific to each instance, and real-time communication is restricted to that instance.
- Operation: Ideal for scenarios where you want real-time communication focused on a single instance.
-
Connection: Connecting to the WebSocket requires using
/instance_namein the URL:
Connecting to WebSocket
Use the following URL format:instance_name with the name of your specific instance.
Example of Establishing WebSocket Connection
Here’s a basic example of how to establish a WebSocket connection using JavaScript:event_name with the specific event you want to listen to.
Event Handling
Once connected, you can listen to various events emitted by the server. Each event can carry data relevant to the event context. For example, if you’re listening for message updates, you might receive data containing the updated message content and metadata.Closing the Connection
To close the WebSocket connection, use thedisconnect method:

