Websocket Endpoint
Edit this pageWebsocket endpoint may be included by passing the ws handler file you specify in your start config. Note that this feature is experimental on the Nitro server and its config may change in future releases of SolidStart. Use it with caution.
Inside the ws file, you can export a partyHandler function to manage WebSocket connections and events:
The partyHandler supports 6 event callbacks:
onStart
: Invoked when the party room is firstly created.onConnect
: Invoked when a new connection is established.onMessage
: Invoked when a message is received.onClose
: Invoked when a connection is closed.onError
: Invoked when an error occurs.onRequest
: Invoked on a HTTP request is made to the party URL.
The party.id
represents the URL path that is shared between all connections in the party.
Beside partyHandler
you can also use eventHandler
to have a more precise control.