UNPKG

bun-ws-router

Version:

A simple and efficient WebSocket router for Bun with Zod/Valibot message validation.

17 lines 699 B
/* SPDX-FileCopyrightText: 2025-present Kriasoft */ /* SPDX-License-Identifier: MIT */ import { WebSocketRouter as BaseWebSocketRouter } from "../shared/router"; import { ZodValidatorAdapter } from "./adapter"; /** * WebSocket router for Bun that provides type-safe message routing with Zod validation. * Routes incoming messages to handlers based on message type. * * @template T - Application-specific data to store with each WebSocket connection. * Always includes a clientId property generated automatically. */ export class WebSocketRouter extends BaseWebSocketRouter { constructor() { super(new ZodValidatorAdapter()); } } //# sourceMappingURL=router.js.map