MCPcopy Create free account
hub / github.com/DeepNotesApp/DeepNotes / unsubscribe

Method unsubscribe

apps/client/src/code/realtime/context.ts:127–155  ·  view source on GitHub ↗
(prefix: DataPrefix, suffix: string, field: string)

Source from the content-addressed store, hash-verified

125 }
126 }
127 unsubscribe(prefix: DataPrefix, suffix: string, field: string) {
128 const fullKey = getFullKey(prefix, suffix, field);
129
130 if (!this.subscriptions.has(fullKey)) {
131 return;
132 }
133
134 this._logger.sub('unsubscribe').info(fullKey);
135
136 this.subscriptions.delete(fullKey);
137
138 this.pending.delete(fullKey);
139
140 internals.realtime.subscriptions[fullKey].delete(this);
141
142 if (internals.realtime.subscriptions[fullKey].size === 0) {
143 delete internals.realtime.subscriptions[fullKey];
144
145 internals.realtime.pending.get(fullKey)?.resolve(undefined);
146 internals.realtime.pending.delete(fullKey);
147
148 delete internals.realtime.values[fullKey];
149
150 internals.realtime.pushCommand({
151 type: RealtimeCommandType.UNSUBSCRIBE,
152 args: [prefix, suffix, field],
153 });
154 }
155 }
156
157 destroy() {
158 for (const channel of this.subscriptions) {

Callers 4

removeUpdateListenerMethod · 0.80
destroyMethod · 0.80
destroyMethod · 0.80
destroySocketMethod · 0.80

Calls 6

getFullKeyFunction · 0.90
subMethod · 0.80
pushCommandMethod · 0.80
getMethod · 0.65
hasMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected