API reference / @chanx-js/server / fastify / chanxFastify
Function: chanxFastify()
ts
function chanxFastify(chanx, __namedParameters?): FastifyPluginAsync;Defined in: packages/server/src/adapters/fastify.ts:29
Serve chanx as Fastify routes, one per consumer path, after registering @fastify/websocket. Fastify's hooks run before each upgrade, so onRequest or an auth plugin can refuse one with an HTTP status. Register it without a prefix: the routes are the consumers' own paths.
ts
await app.register(websocket);
await app.register(chanxFastify(chanx));Parameters
| Parameter | Type |
|---|---|
chanx | Chanx |
__namedParameters | SocketOptions |
Returns
FastifyPluginAsync