Skip to content

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

ParameterType
cContext&lt;{ Variables: ServerVariables; }&gt;
optionsWsUpgradeOptions

Returns

Promise<WSEvents&lt;unknown&gt;>

Stable