How to setup a WebSocket connection?
Learn how to establish a real-time WebSocket connection with VowChat for bi-directional communication and real-time updates.
Why Use WebSocket?
-
Enables bi-directional communication
-
Provides real-time data updates
-
Enhances user experience for dashboards
Connection Setup
Use WebSocket URL: wss://app.vowchat.ai/cable
PubSub Tokens
Two types of tokens:
-
User PubSub Token: For agent/admin privileges
-
Contact PubSub Token: For session-specific access
Connection Example
const connection = new WebSocket("wss://app.vowchat.ai/cable");
connection.send(
stringify({
command: "subscribe",
identifier: stringify({
channel: "RoomChannel",
pubsub_token: pubSubToken,
account_id: accountId,
user_id: userId,
}),
})
);
Event Types
-
conversation.created -
message.created -
typing_on/off -
presence.update
For complete WebSocket documentation and event payload structures, refer to the VowChat developer documentation.
Note: This is an experimental feature with potential changes in future releases.