Add a namespace.
Add a namespace.
This variant allows you to pass a callback that pattern matches on the namespace name, and uses the session data to decide whether the user should be able to connect to this namespace or not.
Any exceptions thrown here will result in an error being sent back to the client, serialized by the errorHandler. Alternatively, you can simply not return a value from the partial function, which will result in an error being sent to the client that the namespace does not exist.
The decoder to use to decode messages.
The encoder to use to encode messages.
A callback to match the namespace and create a flow accordingly.
Add a namespace.
Add a namespace.
The name of the namespace.
The decoder to use to decode messages.
The encoder to use to encode messages.
The flow to use for the namespace.
Build the engine.io controller.
Set the default namespace flow.
Set the default namespace flow.
This variant allows you to customise the returned flow according to the session.
the decoder to use.
the encoder to use.
a callback to create the flow given the session.
Set the default namespace flow.
Set the default namespace flow.
the decoder to use.
the encoder to use.
the flow.
Set the onConnect callback.
Set the onConnect callback.
The callback takes the request header of the incoming connection and the id of the session, and should produce a session object, which can be anything, for example, a user principal, or other authentication and/or authorization details.
If you wish to reject the connection, you can throw an exception, which will later be handled by the error handler to turn it into a message to send to the client.
Set the onConnect callback.
Set the onConnect callback.
The callback takes the request header of the incoming connection and the id of the ssion, and should produce a session object, which can be anything, for example, a user principal, or other authentication and/or authorization details.
If you wish to reject the connection, you can throw an exception, which will later be handled by the error handler to turn it into a message to send to the client.
Set the error handler.
Set the error handler.
If any errors are encountered, they will be serialized to JSON this function, and then passed to the client using a socket.io error message.
Any errors not handled by this partial function will fallback to the existing error handler in this builder, which by default sends the exception message as a JSON string.
A builder for engine.io instances.