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

Method constructor

apps/collab-server/src/sockets.ts:48–80  ·  view source on GitHub ↗
(socket: WebSocket, req: IncomingMessage)

Source from the content-addressed store, hash-verified

46 readonly clientIds: Set<number> = new Set();
47
48 constructor(socket: WebSocket, req: IncomingMessage) {
49 this.socket = socket;
50
51 this.sessionId = req.sessionId;
52
53 // Listen to events
54
55 this.socket.on('message', async (message: ArrayBuffer) => {
56 try {
57 await this._setupPromise;
58
59 await this._handleMessage(message);
60 } catch (error) {
61 moduleLogger.error('Message handling error: %o', error);
62 }
63 });
64
65 this.socket.on('pong', () => {
66 moduleLogger.info(`[${this.room?.name}] Pong received`);
67
68 this.isAwaitingPong = false;
69 });
70
71 this.socket.on('close', async () => {
72 if (this.socket?.aux == null) {
73 return;
74 }
75
76 moduleLogger.info(`[${this.room?.name}] Socket closed`);
77
78 this.destroySocket();
79 });
80 }
81
82 private async _checkSessionInvalidated() {
83 if (this.sessionId != null) {

Callers

nothing calls this directly

Calls 2

_handleMessageMethod · 0.95
destroySocketMethod · 0.95

Tested by

no test coverage detected