Graphorin API reference v0.1.0
Graphorin API reference / @graphorin/server / / createWsUpgradeEvents
Function: createWsUpgradeEvents()
ts
function createWsUpgradeEvents(c, options): Promise<WSEvents<unknown>>;Defined in: packages/server/src/ws/upgrade.ts:71
Build the WSEvents callback bag the Hono helper consumes. The function takes the request Context so the upgrade can read the Authorization header / Sec-WebSocket-Protocol ticket directly.
Production wiring on @hono/node-ws:
ts
const { upgradeWebSocket, injectWebSocket } = createNodeWebSocket({ app });
app.get('/v1/ws', upgradeWebSocket((c) => createWsUpgradeEvents(c, deps)));
injectWebSocket(serve(...));Parameters
| Parameter | Type |
|---|---|
c | Context<{ Variables: ServerVariables; }> |
options | WsUpgradeOptions |
Returns
Promise<WSEvents<unknown>>