@inkly/fastify
v0.0.0
Published
Fastify embedding adapter for inkly (shares the host HTTP server's upgrade).
Readme
@inkly/fastify
Fastify adapter for inkly. It registers as a Fastify plugin, attaches to fastify.server, and claims only the configured WebSocket path on the same port as your HTTP routes.
Install
pnpm add @inkly/fastify @inkly/core @inkly/client fastifyQuickstart
import fastify from "fastify";
import { contract, inkly } from "@inkly/core";
import { inklyFastify } from "@inkly/fastify";
const api = contract({ actions: {}, events: {} });
const ws = inkly(api);
const app = fastify();
app.get("/health", async () => ({ ok: true }));
await app.register(inklyFastify, { inklyApp: ws, path: "/ws" });
await app.listen({ port: 3000 });API
inklyFastify(fastify, { inklyApp, path, authorize, ws })is an async plugin registrable withfastify.register.- The plugin tears down the inkly attachment during Fastify
onClose.
Caveats
This adapter targets Fastify's Node HTTP/1 server. It delegates WebSocket protocol behavior to @inkly/node's attachInkly.
