Import packages/plugin/src/node-websocket.ts
This commit is contained in:
parent
2946f1d354
commit
49cc56fc72
|
|
@ -0,0 +1,18 @@
|
|||
import WebSocket from 'ws'
|
||||
|
||||
/**
|
||||
* Host control / Relay data sockets for the Plugin Host process (#353).
|
||||
*
|
||||
* Scope: `HostServerConnection` only. `dsh web` replaces the process-global
|
||||
* `WebSocket` with an implementation that attaches `Origin` from the Harness
|
||||
* page. Self-hosted Servers compare that header to `DSH_SERVER_PUBLIC_URL` and
|
||||
* reject mismatches (`origin_mismatch` → Host stays offline).
|
||||
*
|
||||
* The bundled `ws` client omits `Origin` unless `origin` is set. Browser Remote
|
||||
* clients and AdaptiveTransport / RelayTransport keep the global `WebSocket`
|
||||
* (browsers must send Origin). Plugin Client mode in `dsh web` is out of scope
|
||||
* for this fix and needs its own justification and coverage if required later.
|
||||
*/
|
||||
export function createNodeWebSocket(url: string): WebSocket {
|
||||
return new WebSocket(url, { perMessageDeflate: false })
|
||||
}
|
||||
Loading…
Reference in New Issue