FluxyChat

Platform

Transport

WebSocket, SSE, polling, and Durable Object room state.

Realtime delivery uses a WebSocket-first stack with automatic fallback in the SDK.

Primary: WebSocket

GET /ws/room/:roomId?token=<JWT>

Room state lives in a Durable Object — reconnections resume membership and recent history without losing the room kernel.

import { FluxyChatClient } from "@fluxy-chat/sdk";

const client = new FluxyChatClient({ baseUrl, userId, token: jwt });
await client.connect();
await client.joinRoom(roomId);

Fallback chain

When the socket cannot stay up, useChat degrades automatically:

WebSocket → SSE (/rooms/:id/stream) → polling (GET /api/messages)

See Transport fallback.

REST publish

Backends and cron jobs can publish without a socket:

curl -X POST "$FLUXY_BASE_URL/messages" \
  -H "Authorization: Bearer $JWT" \
  -H "Content-Type: application/json" \
  -d '{ "roomId": "alerts", "content": "Deploy complete" }'

Connected clients still receive the event over WebSocket.

Comparison

LayerLatencyWhen to use
WebSocketLowestLive chat, agents, presence
SSEMediumMobile/proxy environments
REST pollingHighestLast-resort fallback
REST POSTN/AServer-initiated messages

Firewall note

If corporate proxies block WebSockets, the SDK still delivers via SSE/polling — surface connectionState.transport in your UI.

On this page