Skip to content

DF0057: WebSocket Transport Disabled

Message

This instance disables its WebSocket transport (ws: false), so there is no socket to drive upgrades into.

Cause

ws: false runs the instance without a WebSocket: clients connect over the SSE endpoint instead (backend: 'sse'). There is therefore no socket for attach(server) / handleUpgrade(req, socket, head) to feed — the host wiring that exists solely to route upgrade events has nothing to route to.

Example

ts
import { initDevframe } from 'devframe/initiate'

const sseOnly = initDevframe(def, {
  base: '/__my-tool/',
  ws: false,
})
sseOnly.attach(myServer) // ✗ throws DF0057 — there is no socket

// ✓ SSE needs no upgrade wiring; serve the HTTP surface and you're done.
myServer.on('request', (req, res) => sseOnly.nodeMiddleware(req, res))

Fix

Drop the attach / handleUpgrade wiring — the SSE endpoint rides the instance's ordinary HTTP surface (handler / nodeMiddleware), so serving requests is all a host needs to do. Remove ws: false if the instance should serve a WebSocket after all.

Source

Released under the MIT License.