WebSocket API

Low-level WebSocket protocol reference for NoLag real-time communication.

Connection

Connect to the NoLag WebSocket endpoint:

wss://ws.nolag.io/v1

Authentication

Send an authentication message immediately after connecting:

{
  "type": "auth",
  "token": "your_access_token"
}

Message Types

Subscribe

{
  "type": "subscribe",
  "topic": "app/room/topic"
}

Unsubscribe

{
  "type": "unsubscribe",
  "topic": "app/room/topic"
}

Publish

{
  "type": "publish",
  "topic": "app/room/topic",
  "data": { "your": "payload" },
  "qos": 0
}

Incoming Message

{
  "type": "message",
  "topic": "app/room/topic",
  "data": { "your": "payload" },
  "timestamp": 1234567890
}

QoS Levels

  • 0 - At most once (fire and forget)
  • 1 - At least once (acknowledged delivery)
  • 2 - Exactly once (guaranteed single delivery)

Next Steps