MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / send

Method send

src/ui-server/api/events.ts:277–286  ·  view source on GitHub ↗
(client: Client, event: WireEvent)

Source from the content-addressed store, hash-verified

275 }
276
277 private send(client: Client, event: WireEvent): void {
278 if (client.res.writableEnded) return;
279 try {
280 // `retry` on every frame is cheap and means a client that reconnects with
281 // the browser's own EventSource still backs off the way we asked.
282 client.res.write(`retry: 3000\nevent: ${event.type}\ndata: ${JSON.stringify(event)}\n\n`);
283 } catch {
284 this.drop(client);
285 }
286 }
287
288 private broadcast(event: WireEvent): void {
289 for (const client of [...this.clients]) this.send(client, event);

Callers 2

subscribeMethod · 0.95
broadcastMethod · 0.95

Calls 2

dropMethod · 0.95
writeMethod · 0.65

Tested by

no test coverage detected