xviz/docs/api-reference/server/overview-handler.md

1.3 KiB

XVIZHandler Interface

An XVIZHandler will be called to provide an XVIZSession to handle the request made to the XVIZServer.

Interface

async newSession(socket, request)

Using the socket and request a handler must decide if this connection can be handled.

Parameters:

  • socket (Object) - The socket from the server
  • request (Object) - The request object from the server

Returns: (XVIZSession|null) - A session to handle this connection or null if the request cannot be handled.

XVIZProviderHandler Example

The xvizserver tool uses this modules XVIZProviderHandler implementation to host XVIZ data.

Below we can see the flow where the XVIZProviderHandler uses an array of directories and then calls the XVIZProviderFactory to attempt to satisfy the request and returns the XVIZProviderSession upon a successful find.

@xviz/server handler diagram

Diagram of the flow for how the XVIZProviderHandler creates an XVIZProviderSession