Skip to content

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 AliasDescription
ClientMessageInferred TypeScript union for the ClientMessage discriminator. A value satisfying this type round-trips through ClientMessageSchema without throwing.
ClientMessageIdConvenience type for the JSON-RPC id slot. Matches the Graphorin subset (string + integer; no null, no float).

Variables

VariableDescription
ClientMessageSchemaZod 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

FunctionDescription
isCancelledNotification-
isInitializeRequestType guard helpers — one per method literal — so consumers can narrow the ClientMessage union without re-stringifying the discriminator.
isPingRequest-
isRunCancelRequest-
isSubscribeRequest-
isUnsubscribeRequest-