attachWebSocket
View as Markdownfunction attachWebSocket( hub, server, o?): () => void;Defined in: hub/src/node/ws.ts:53
Accepts machine WebSockets on server at path (default <basePath>/agent), the traditional
mode transport; agents are offered ws at path (before http) until detached. Also runs hub.maintain() every
maintenance.intervalMs (default 60 s) in this long-running process. Returns a function that stops accepting new sockets
(connected machines stay until hub.close()); hub.close() detaches too. One server per hub
at a time: a second call before detaching throws.
const server = app.listen(3000); attachWebSocket(hub, server);
Parameters
Section titled “Parameters”| Parameter | Type |
|---|---|
hub |
Hub |
server |
Server |
o? |
{ path?: string; } |
o.path? |
string |
Returns
Section titled “Returns”() => void