- Docs
- API Reference
- Socket Protocol
Socket Protocol
Understand the QPub WebSocket protocol for real-time communication.
Overview
The QPub Socket Protocol provides real-time, bidirectional communication using WebSocket connections.
Connection
WebSocket URL
wss://api.qpub.com/v1/socket
Authentication
Send authentication message upon connection:
{
"type": "auth",
"apiKey": "your-api-key"
}Message Format
All messages follow a consistent JSON structure:
{
"type": "message_type",
"data": { ... },
"timestamp": "2024-01-01T00:00:00Z"
}Message Types
Client to Server
- auth: Authenticate connection
- subscribe: Subscribe to channel
- unsubscribe: Unsubscribe from channel
- publish: Publish message to channel
Server to Client
- connected: Connection established
- message: Received message
- error: Error notification
- status: Connection status update
Connection Lifecycle
- Connect: Establish WebSocket connection
- Authenticate: Send authentication message
- Subscribe: Subscribe to channels
- Communicate: Send and receive messages
- Disconnect: Close connection
This page is under construction. Socket protocol documentation will be expanded soon.
Previous
Constructor
Next
REST API