MCPcopy Index your code
hub / github.com/DeepNotesApp/DeepNotes / connect

Method connect

apps/client/src/code/realtime/client.ts:54–84  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

52 }
53
54 connect() {
55 super.connect();
56
57 this.socket?.addEventListener('open', () => {
58 if (this._isFirstConnection) {
59 this._logger.info('First connection');
60 this._isFirstConnection = false;
61 return;
62 }
63
64 this._logger.info('Reconnecting');
65
66 for (const fullKey of Object.keys(this.subscriptions)) {
67 const [key, field] = splitStr(fullKey, '>', 2);
68 const [prefix, suffix] = splitStr(key, ':', 2);
69
70 this.commandBuffer.push({
71 type: RealtimeCommandType.SUBSCRIBE,
72 args: [prefix, suffix, field],
73 });
74 }
75
76 if (this.commandBuffer.length > 0) {
77 setTimeout(this.flushCommandBuffer);
78 }
79 });
80
81 this.socket?.addEventListener('message', (event) => {
82 this._handleMessage(new Uint8Array(event.data));
83 });
84 }
85
86 // Get commands
87

Callers 1

auth.client.tsFile · 0.45

Calls 2

splitStrFunction · 0.90
_handleMessageMethod · 0.45

Tested by

no test coverage detected