MCPcopy
hub / github.com/cpaczek/skylight / onConnect

Method onConnect

tracker/src/hub.ts:123–135  ·  view source on GitHub ↗
(ws: WebSocket)

Source from the content-addressed store, hash-verified

121 }
122
123 private onConnect(ws: WebSocket): void {
124 this.clients.add(ws);
125 this.send(ws, {
126 type: "trackerConfig",
127 config: this.upstream.getConfig().tracker,
128 });
129 const state = this.loop.getState();
130 if (state) this.send(ws, { type: "trackerState", state });
131
132 ws.on("message", (raw) => this.onMessage(raw.toString()));
133 ws.on("close", () => this.clients.delete(ws));
134 ws.on("error", () => this.clients.delete(ws));
135 }
136
137 private onMessage(raw: string): void {
138 let msg: TrackerClientMessage;

Callers 1

constructorMethod · 0.95

Calls 5

sendMethod · 0.95
onMessageMethod · 0.95
addMethod · 0.80
getStateMethod · 0.80
getConfigMethod · 0.65

Tested by

no test coverage detected