MCPcopy
hub / github.com/srcbookdev/srcbook / push

Method push

packages/web/src/clients/websocket/channel.ts:109–123  ·  view source on GitHub ↗
(event: K, payload: z.TypeOf<O[K]>)

Source from the content-addressed store, hash-verified

107 }
108
109 push<K extends keyof O & string>(event: K, payload: z.TypeOf<O[K]>): void {
110 // Queue outgoing events until we are subscribed.
111 if (!this.subscribed) {
112 this.queue.push({ event, payload });
113 return;
114 }
115
116 const schema = this.events.outgoing[event];
117
118 if (schema === undefined) {
119 throw new Error(`Cannot push unknown event '${event}' for topic '${this.topic}'`);
120 }
121
122 this.client.push(this.topic, event, schema.parse(payload));
123 }
124
125 private receiveSubscribedEvent(payload: { id: string }) {
126 // This shouldn't normally happen, but could if multiple channels for the

Callers 15

flushMethod · 0.95
PackageJsonProviderFunction · 0.45
updateCellOnServerFunction · 0.45
groupModelsByProviderFunction · 0.45
TsConfigProviderFunction · 0.45
onUpdateFileNameFunction · 0.45
generateFunction · 0.45
aiFixDiagnosticsFunction · 0.45
runCellFunction · 0.45
stopCellFunction · 0.45
formatCellFunction · 0.45
onGetDefinitionContentsFunction · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected