Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/server / / WsDispatcher
Interface: WsDispatcher
Defined in: packages/server/src/ws/dispatcher.ts:137
Public surface of the dispatcher.
Stable
Properties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
replayBuffer | readonly | ReplayBuffer | packages/server/src/ws/dispatcher.ts:139 |
sanitizer | readonly | DeliveryCommentarySanitizer | packages/server/src/ws/dispatcher.ts:138 |
Methods
emit()
emit(subject, frame): void;Defined in: packages/server/src/ws/dispatcher.ts:163
Push an event into the dispatcher. Goes through the sanitizer, validates against the protocol schema, persists into the replay buffer, and fans out to every matching active subscription.
Parameters
| Parameter | Type |
|---|---|
subject | string |
frame | BareEventFrame |
Returns
void
emitLifecycle()
emitLifecycle(
subscriptionId,
status,
reason?): void;Defined in: packages/server/src/ws/dispatcher.ts:165
Push a lifecycle frame to a single subscription.
Parameters
| Parameter | Type |
|---|---|
subscriptionId | string |
status | "aborted" | "running" | "completed" | "failed" | "paused" |
reason? | string |
Returns
void
listForSubscriber()
listForSubscriber(subscriberId): readonly WsSubscriptionSnapshot[];Defined in: packages/server/src/ws/dispatcher.ts:171
List active subscriptions for a given subscriber (diagnostics).
Parameters
| Parameter | Type |
|---|---|
subscriberId | string |
Returns
readonly WsSubscriptionSnapshot[]
registerSubscriber()
registerSubscriber(handle): {
unregister: void;
};Defined in: packages/server/src/ws/dispatcher.ts:144
Register a subscriber (one per WebSocket connection). unregister is called on close.
Parameters
| Parameter | Type |
|---|---|
handle | WsSubscriberHandle |
Returns
{
unregister: void;
}| Name | Type | Defined in |
|---|---|---|
unregister() | () => void | packages/server/src/ws/dispatcher.ts:144 |
shutdown()
shutdown(): void;Defined in: packages/server/src/ws/dispatcher.ts:175
Clear in-memory state (used during graceful shutdown).
Returns
void
size()
size(): {
subscribers: number;
subscriptions: number;
};Defined in: packages/server/src/ws/dispatcher.ts:173
Returns
{
subscribers: number;
subscriptions: number;
}| Name | Type | Defined in |
|---|---|---|
subscribers | number | packages/server/src/ws/dispatcher.ts:173 |
subscriptions | number | packages/server/src/ws/dispatcher.ts:173 |
snapshotSubscription()
snapshotSubscription(subscriptionId):
| WsSubscriptionSnapshot
| undefined;Defined in: packages/server/src/ws/dispatcher.ts:172
Parameters
| Parameter | Type |
|---|---|
subscriptionId | string |
Returns
| WsSubscriptionSnapshot | undefined
subscribe()
subscribe(input): SubscribeResult;Defined in: packages/server/src/ws/dispatcher.ts:151
Open a new subscription for an active subscriber. Returns either the subscription snapshot + replayed-event count or a typed failure reason the caller maps to the appropriate close code / RPC error.
Parameters
| Parameter | Type |
|---|---|
input | { sinceEventId?: string; subject: string; subscriberId: string; subscriptionId: string; } |
input.sinceEventId? | string |
input.subject | string |
input.subscriberId | string |
input.subscriptionId | string |
Returns
unsubscribe()
unsubscribe(subscriptionId): boolean;Defined in: packages/server/src/ws/dispatcher.ts:157
Parameters
| Parameter | Type |
|---|---|
subscriptionId | string |
Returns
boolean