MCPcopy Create free account
hub / github.com/srcbookdev/srcbook / on

Method on

packages/web/src/clients/websocket/client.ts:34–37  ·  view source on GitHub ↗
(topic: string, callback: (event: string, payload: Record<string, any>) => void)

Source from the content-addressed store, hash-verified

32 }
33
34 on(topic: string, callback: (event: string, payload: Record<string, any>) => void) {
35 this.callbacks[topic] = this.callbacks[topic] || [];
36 this.callbacks[topic]?.push(callback);
37 }
38
39 off(topic: string, callback: (event: string, payload: Record<string, any>) => void) {
40 const callbacks = (this.callbacks[topic] || []).filter((cb) => cb !== callback);

Callers

nothing calls this directly

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected