WebSocket /v1/ws
The WebSocket endpoint is used for realtime call signaling.
URL
wss://rtc-svc.blendlix.com/v1/ws
Browser authentication
Browser clients should use the jwt subprotocol:
const ws = new WebSocket('wss://rtc-svc.blendlix.com/v1/ws', ['jwt', sessionToken])
Server-side authentication
Server-side clients may use:
Authorization: Bearer <session_token>
Successful connection event
After authentication, the client receives:
{
"event": "auth.ok",
"success": true,
"data": {
"socket_id": "socket-id",
"user_id": "caller-123",
"role": "caller",
"display_name": "Caller One"
}
}
Event envelope
All client-to-service messages use this shape:
{
"event": "call.invite",
"request_id": "req-1",
"data": {}
}
Common events
| Event | Direction | Purpose |
|---|---|---|
call.invite | client to service | Start ringing the receiver. |
call.ringing | service to receiver | Incoming call notification. |
call.accept | client to service | Accept a ringing call. |
call.accepted | service to participant | Notify the other participant that the call was accepted. |
call.reject | client to service | Reject a ringing call. |
call.rejected | service to participant | Notify the other participant that the call was rejected. |
call.cancel | client to service | Caller cancels before answer. |
call.canceled | service to participant | Notify the receiver that the call was canceled. |
call.connected | client/service | Mark a call as connected. |
call.end | client to service | End an active call. |
call.ended | service to participant | Notify the other participant that the call ended. |
call.missed | service to participant | Ringing timeout reached. |
call.error | service to client | The request failed. |
webrtc.offer | participant to participant | Send WebRTC offer. |
webrtc.answer | participant to participant | Send WebRTC answer. |
webrtc.ice_candidate | participant to participant | Send ICE candidate. |
Error envelope
{
"event": "call.error",
"request_id": "req-1",
"success": false,
"error": {
"code": "CALL_INVALID_STATE",
"message": "call can only be accepted while ringing"
}
}