hono-party
Version:
Use PartyServer with Hono
23 lines (20 loc) • 763 B
TypeScript
import * as hono from "hono";
import { Env } from "hono";
import { PartyServerOptions } from "partyserver";
/**
* Configuration options for the PartyServer middleware
*/
type PartyServerMiddlewareContext<E extends Env> = {
/** PartyServer-specific configuration options */
options?: PartyServerOptions<E>;
/** Optional error handler for caught errors */
onError?: (error: Error) => void;
};
/**
* Creates a middleware for handling PartyServer WebSocket and HTTP requests
* Processes both WebSocket upgrades and standard HTTP requests, delegating them to PartyServer
*/
declare function partyserverMiddleware<E extends Env = Env>(
ctx?: PartyServerMiddlewareContext<E>
): hono.MiddlewareHandler<any, string, {}>;
export { partyserverMiddleware };