ProtectedconstructorThe application blueprint.
Protected ReadonlyblueprintProtected ReadonlyhooksProtected ReadonlyloggerProtected ReadonlymiddlewareProtected ReadonlyresolvedProtected OptionalserverProtected ReadonlyurlProtectedbuildBuild the raw response.
The event context.
OptionaleventHandler: AdapterEventHandlerType<IncomingEvent, OutgoingResponse>
The event handler to be run.
The raw response wrapper.
ProtectedcreateCreate the ws server, honouring an injected factory (tests / custom transports).
The server.
ProtecteddispatchNormalize a socket event into an IncomingEvent and route it through the kernel.
The originating socket.
The connection.
The routing key (a lifecycle key or event:<channel>:<event>).
Optionalpayload: unknown
The payload carried to the handler.
ProtectedexecuteExecute the event handler lifecycle hooks.
The hook to execute.
The event handler to be run.
ProtectedexecuteExecute adapter lifecycle hooks.
The hook's name.
Optionalcontext: NodeWsAdapterContext
The event context.
Optionalerror: any
The error to handle.
ProtectedhandleHandle a closed socket: drop the connection and notify gateways.
The originating socket.
The connection.
ProtectedhandleHandle a newly accepted socket: register the connection and wire its events.
The accepted socket.
ProtectedhandleHandle error.
The error to handle.
The event context.
The raw response.
ProtectedhandleHandle the event.
The event context.
The event handler to be run.
The raw response wrapper.
ProtectedhandleHandle an inbound frame: control frames update presence; every frame is routed through the kernel.
The originating socket.
The connection.
The raw payload.
ProtectedmakeCreate pipeline options for the Adapter.
The pipeline options for transforming the event.
ProtectedonProtectedresolveGet the error handler for the given error.
The error to get the handler for.
The error handler.
ProtectedresolveProtectedresolveResolve the listen port from the configured URL (defaults to 8080).
The port.
Start the WebSocket server and wire connection handling.
The running server.
ProtectedsendSend the raw event through the destination.
The event context.
The event handler to be run.
Platform-specific response.
ProtectedsendSend a kernel response back to the originating socket when it carries content.
The socket.
The raw response.
Stop the server and run the stop hooks.
A connected client keeps the underlying server open, and a WebSocket client stays connected by
definition: close() alone therefore never calls back for as long as anyone is listening, which
is a realtime server's normal state. Every client is asked to leave with 1001 Going away, the
code a browser reads as "reconnect later", and whoever has not gone by the end of the grace
period is dropped. A stop that cannot finish is not a stop.
ProtectedstoreThe shared connection store the default broadcaster reads, if realtime is enabled.
The store, or undefined.
ProtectedvalidateValidate the context and event handler.
The context to validate.
The event handler to validate.
StaticcreateCreate a NodeWsAdapter.
The application blueprint.
A new instance.
Node.js WebSocket adapter for Stone.js.
Runs a
wsserver and bridges sockets to@stone-js/realtime: each accepted socket becomes a Connection added to the shared connection store (sobroadcastreaches it). Every socket event (connect, subscribe, unsubscribe, message, per-channel event, error, disconnect) is normalized into anIncomingEvent, keyed by its lifecycle/channel key, and run through the kernel, where the light key-router from@stone-js/routerroutes it to the matching@On*gateway method. The connection store stays in the adapter (infrastructure); dispatch is one pattern everywhere.wsis an optional peer dependency, imported lazily. The core is never touched: this adapter is pure Integration, normalizing socket causes into intentions.