Open realtime WebSocket
GET/realtime/ws
Upgrades the connection to a WebSocket used for realtime DB subscriptions and writes. Client messages use {action, path, value}, server messages use {event, path, value}.
Request
Responses
- 101
- 401
- 403
Switching Protocols
Unauthorized
Forbidden
Client message examples
Subscribe:
{
"action": "subscribe",
"path": "rooms/room1"
}
Set node:
{
"action": "set",
"path": "rooms/room1/messages/msg1",
"value": {
"text": "Hello",
"from": "alice"
}
}
Server message examples
Initial snapshot:
{
"event": "init",
"path": "rooms/room1",
"value": {
"messages": {
"msg1": {
"text": "Hello",
"from": "alice"
}
}
}
}
Live update:
{
"event": "update",
"path": "rooms/room1/messages/msg2/text",
"value": "Hey there"
}