Dokümantasyon

Realtime

SSE ve WebSocket. Scope: realtime:subscribe.

Kanallar

WAL NOTIFY → liap-realtime.

Tarayıcı WS: access_token query veya Sec-WebSocket-Protocol: liap.<token>.

MethodPathAçıklama
GET/realtime/stream?table=todosSSE
WSwss://{EDGE}/realtime/ws?table=todosWebSocket
GET/realtime/presence?channel=Presence
POST/realtime/broadcastBroadcast (204)

SSE

Node.js
const res = await fetch(
  `${EDGE}/realtime/stream?table=todos`,
  { headers: { 'X-Liap-Key': API_KEY } },
)
const reader = res.body.getReader()
const dec = new TextDecoder()
for (;;) {
  const { done, value } = await reader.read()
  if (done) break
  console.log(dec.decode(value))
}

WebSocket

Node.js
import WebSocket from 'ws'
const ws = new WebSocket(
  `${EDGE.replace(/^http/, 'ws')}/realtime/ws?table=todos`,
  { headers: { 'X-Liap-Key': API_KEY } },
)
ws.on('message', (buf) => console.log(String(buf)))

Docs · API