@fluxy-chat/protocol
v0.1.0
Published
Shared FluxyChat wire protocol — WebSocket event types and validators for SDKs and the worker
Readme
@fluxy-chat/protocol
Shared wire protocol for FluxyChat clients and the worker.
What it covers
- Canonical inbound WebSocket event types (server → client)
- Canonical outbound client event types (client → room)
- Lightweight runtime guards (
isFluxyInboundEvent,isFluxyOutboundEvent)
Usage
import { isFluxyInboundEvent, FLUXY_INBOUND_EVENT_TYPES } from "@fluxy-chat/protocol";
socket.onmessage = (raw) => {
const data = JSON.parse(raw.data);
if (!isFluxyInboundEvent(data)) return;
// dispatch by data.type
};P21 contract tests
SDK packages should keep their event unions aligned with FLUXY_INBOUND_EVENT_TYPES. When adding a new WS event in the worker:
- Add to
@fluxy-chat/protocolinbound/outbound lists - Update Room DO handler
- Extend SDK
FluxyChatEventunion - Run
pnpm --filter @fluxy-chat/protocol test
