Skip to content

upgradeWebSocket

reference
1 min readUpdated

Kind: Constant

Source: src/adapter/deno/websocket.ts

Part of: Adapter

Definition

ts
UpgradeWebSocket<WebSocket, Deno.UpgradeWebSocketOptions>

Value

ts
defineWebSocketHelper(async (c, events, options) => {
    if (c.req.header('upgrade') !== 'websocket') {
      return
    }

    // Echo the negotiated subprotocol back to the client. Browsers (e.g. Chrome)
    // reject the connection when a subprotocol was requested but the response is
    // missing the `Sec-WebSocket-Protocol` header.
    const subprotocol = c.req.header('sec-websocket-protoco…

Relationships

  • IMPORTS → WSContext
  • IMPORTS → defineWebSocketHelper

Was this page helpful?

Download as PDF
upgradeWebSocket — Hono (narrator proof)