MCPcopy Create free account
hub / github.com/TraderAlice/OpenAlice / wireWs

Method wireWs

src/workspaces/persistent-session.ts:531–544  ·  view source on GitHub ↗
(ws: WebSocket)

Source from the content-addressed store, hash-verified

529 }
530
531 private wireWs(ws: WebSocket): void {
532 const messageHandler = (raw: unknown, isBinary: boolean): void =>
533 this.onWsMessage(ws, raw, isBinary);
534 const closeHandler = (): void => {
535 if (this.ws === ws) this.detach();
536 };
537 const errorHandler = closeHandler;
538 ws.on('message', messageHandler);
539 ws.on('close', closeHandler);
540 ws.on('error', errorHandler);
541 this.messageHandler = messageHandler;
542 this.closeHandler = closeHandler;
543 this.errorHandler = errorHandler;
544 }
545
546 private unwireWs(ws: WebSocket): void {
547 if (this.messageHandler) ws.off('message', this.messageHandler);

Callers 1

attachMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected