function setupGroupWSHandler
setupGroupWSHandler(
server: HTTPServer,
groupConfigs: Config[]
): void

Attaches the shared WebSocket event dispatcher to server.wss. Routes each socket's messages to the correct group's Config using the groupId baked into the browser-side wsOpen message by testRuntimeToInject.

import * as WebServer from './web-server.ts';

import type { Config } from '../types.ts';
import type { HTTPServer } from '../web/index.ts';

// Defined, not invoked: attaches WS listeners to a live shared server.
function example(server: HTTPServer, groupConfigs: Config[]) {
  WebServer.setupGroupWSHandler(server, groupConfigs); // one dispatcher, routed by each socket's wsOpen groupId
}

Parameters

server: HTTPServer
groupConfigs: Config[]

Return Type

void

Usage

import { setupGroupWSHandler } from "lib/setup/web-server.ts";