From 2cb1fa5e14c343521784097b77655e5493853c17 Mon Sep 17 00:00:00 2001 From: dwelle <5153846+dwelle@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:11:15 +0100 Subject: [PATCH] wip --- excalidraw-app/collab/Collab.tsx | 4 ++++ excalidraw-app/collab/Portal.tsx | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx index 92d94dbc9..aff6af24b 100644 --- a/excalidraw-app/collab/Collab.tsx +++ b/excalidraw-app/collab/Collab.tsx @@ -442,6 +442,7 @@ class Collab extends PureComponent { ); const fallbackInitializationHandler = () => { + console.log("fallbackInitializationHandler"); this.initializeRoom({ roomLinkData: existingRoomLinkData, fetchScene: true, @@ -516,7 +517,9 @@ class Collab extends PureComponent { case WS_SUBTYPES.INVALID_RESPONSE: return; case WS_SUBTYPES.INIT: { + console.log("INIT (1)"); if (!this.portal.socketInitialized) { + console.log("INIT (2)"); this.initializeRoom({ fetchScene: false }); const remoteElements = decryptedData.payload.elements; const reconciledElements = this.reconcileElements(remoteElements); @@ -606,6 +609,7 @@ class Collab extends PureComponent { ); this.portal.socket.on("first-in-room", async () => { + console.log("first-in-room"); if (this.portal.socket) { this.portal.socket.off("first-in-room"); } diff --git a/excalidraw-app/collab/Portal.tsx b/excalidraw-app/collab/Portal.tsx index bf8ffa5de..46348c733 100644 --- a/excalidraw-app/collab/Portal.tsx +++ b/excalidraw-app/collab/Portal.tsx @@ -38,9 +38,17 @@ class Portal { this.roomId = id; this.roomKey = key; + this.socket.on("connect", () => { + console.log("connect"); + }); + + console.log("subbing to init-room"); + // Initialize socket listeners this.socket.on("init-room", () => { + console.log("init-room (1)"); if (this.socket) { + console.log("init-room (2)"); this.socket.emit("join-room", this.roomId); trackEvent("share", "room joined"); } @@ -53,6 +61,7 @@ class Portal { ); }); this.socket.on("room-user-change", (clients: SocketId[]) => { + console.log("room-user-change", clients); this.collab.setCollaborators(clients); });