Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/protocol / client-message
client-message
ClientMessage — discriminated union of every frame a Graphorin WebSocket client may send to the server. The wire is hybrid: the control plane uses JSON-RPC-shaped requests / notifications; the data plane uses typed push events emitted exclusively by the server (see ./server-message.ts).
Every frame carries the v: '1' literal so future revisions can negotiate forward-compatible additions without a subprotocol bump. The matching subprotocol identifier is graphorin.protocol.v1 (see ./subprotocol.ts).
Type Aliases
| Type Alias | Description |
|---|---|
| ClientMessage | Inferred TypeScript union for the ClientMessage discriminator. A value satisfying this type round-trips through ClientMessageSchema without throwing. |
| ClientMessageId | Convenience type for the JSON-RPC id slot. Matches the Graphorin subset (string + integer; no null, no float). |
Variables
| Variable | Description |
|---|---|
| ClientMessageSchema | Zod schema for every legal client → server frame. Use ClientMessageSchema.safeParse() inside the server upgrade handler before dispatching to the corresponding subscription / cancel / ping handler. |
Functions
| Function | Description |
|---|---|
| isCancelledNotification | - |
| isInitializeRequest | Type guard helpers — one per method literal — so consumers can narrow the ClientMessage union without re-stringifying the discriminator. |
| isPingRequest | - |
| isRunCancelRequest | - |
| isSubscribeRequest | - |
| isUnsubscribeRequest | - |