DF0055: Instance Already Owns Its WebSocket Transport

This instance already owns its WebSocket transport ({tier}), so it cannot take over the host's upgrade events.

Message

This instance already owns its WebSocket transport ({tier}), so it cannot take over the host's upgrade events.

Cause

attach(server) / handleUpgrade(req, socket, head) exist for the tier where the instance binds nothing and waits for the host to hand upgrade events over. When the options already name a local binding (ws.port or ws.sidecar (tier: 'sidecar') or server (tier: 'server')), that transport already serves the socket, so routing a second server's upgrades into it would give the same RPC group two conflicting bindings.

Example

import { initHub } from '@devframes/hub/initiate'

const hub = initHub({ base: '/__devframes/', ws: { sidecar: true } })
hub.attach(myServer) // ✗ throws DF0055: the side-car already serves `__ws`

Fix

Drop the attach / handleUpgrade call and let the configured transport serve the socket, or remove server / ws.port / ws.sidecar so the instance leaves the binding to you.

Source