Endpoint
Authentication
Apps authenticate using a JWT token in the Authorization header, along with session information in custom headers.Headers
JWT Token Structure
The appJwt must contain:packageName: The app’s package identifierapiKey: The app’s API key
Connection Flow
1
Webhook Notification
App receives webhook when user starts the app
2
WebSocket Connection
App connects to WebSocket with JWT and session headers
3
Authentication
Server validates JWT token and verifies API key
4
Session Binding
App is bound to the user’s active session
5
Connection Init
App sends CONNECTION_INIT to complete handshake
Message Types
App → Cloud Messages
All message types are defined inpackages/sdk/src/types/messages/app-to-cloud.ts:
CONNECTION_INIT
SUBSCRIPTION_UPDATE
DISPLAY_REQUEST
PHOTO_REQUEST
AUDIO_PLAY_REQUEST
Cloud → App Messages
All message types are defined inpackages/sdk/src/types/messages/cloud-to-app.ts:
CONNECTION_ACK
DATA_STREAM
SETTINGS_UPDATE
APP_STOPPED
Subscription System
Apps must subscribe to the data streams they want to receive. Available stream types are defined inpackages/sdk/src/types/streams.ts:
Hardware Streams
button_press- Button press eventshead_position- Head position changeslocation_update- GPS location updatesvps_coordinates- Visual positioning system
Audio Streams
transcription- Speech-to-text resultstranslation- Real-time translationVAD- Voice activity detectionaudio_chunk- Raw audio data
Phone Streams
phone_notification- Incoming notificationsphone_notification_dismissed- Dismissal eventscalendar_event- Calendar updates
System Streams
start_app- App start requestsstop_app- App stop requestscore_status_update- System status
Media Streams
photo_taken- Photo capture eventsrtmp_stream_status- RTMP streaming statusmanaged_stream_status- Managed streaming
Error Handling
Authentication Errors
Subscription Errors
Heartbeat
Apps must send heartbeat messages to maintain their connection:Implementation Details
- Service:
AppWebSocketService(packages/cloud/src/services/websocket/websocket-app.service.ts) - Manager:
AppManagerhandles app lifecycle and state - Authentication: API key validation against app database
- Subscriptions:
SubscriptionServicemanages data stream routing