This commit is contained in:
dwelle 2024-01-16 17:11:15 +01:00
parent a4e5e46dd1
commit 2cb1fa5e14
2 changed files with 13 additions and 0 deletions

View File

@ -442,6 +442,7 @@ class Collab extends PureComponent<Props, CollabState> {
); );
const fallbackInitializationHandler = () => { const fallbackInitializationHandler = () => {
console.log("fallbackInitializationHandler");
this.initializeRoom({ this.initializeRoom({
roomLinkData: existingRoomLinkData, roomLinkData: existingRoomLinkData,
fetchScene: true, fetchScene: true,
@ -516,7 +517,9 @@ class Collab extends PureComponent<Props, CollabState> {
case WS_SUBTYPES.INVALID_RESPONSE: case WS_SUBTYPES.INVALID_RESPONSE:
return; return;
case WS_SUBTYPES.INIT: { case WS_SUBTYPES.INIT: {
console.log("INIT (1)");
if (!this.portal.socketInitialized) { if (!this.portal.socketInitialized) {
console.log("INIT (2)");
this.initializeRoom({ fetchScene: false }); this.initializeRoom({ fetchScene: false });
const remoteElements = decryptedData.payload.elements; const remoteElements = decryptedData.payload.elements;
const reconciledElements = this.reconcileElements(remoteElements); const reconciledElements = this.reconcileElements(remoteElements);
@ -606,6 +609,7 @@ class Collab extends PureComponent<Props, CollabState> {
); );
this.portal.socket.on("first-in-room", async () => { this.portal.socket.on("first-in-room", async () => {
console.log("first-in-room");
if (this.portal.socket) { if (this.portal.socket) {
this.portal.socket.off("first-in-room"); this.portal.socket.off("first-in-room");
} }

View File

@ -38,9 +38,17 @@ class Portal {
this.roomId = id; this.roomId = id;
this.roomKey = key; this.roomKey = key;
this.socket.on("connect", () => {
console.log("connect");
});
console.log("subbing to init-room");
// Initialize socket listeners // Initialize socket listeners
this.socket.on("init-room", () => { this.socket.on("init-room", () => {
console.log("init-room (1)");
if (this.socket) { if (this.socket) {
console.log("init-room (2)");
this.socket.emit("join-room", this.roomId); this.socket.emit("join-room", this.roomId);
trackEvent("share", "room joined"); trackEvent("share", "room joined");
} }
@ -53,6 +61,7 @@ class Portal {
); );
}); });
this.socket.on("room-user-change", (clients: SocketId[]) => { this.socket.on("room-user-change", (clients: SocketId[]) => {
console.log("room-user-change", clients);
this.collab.setCollaborators(clients); this.collab.setCollaborators(clients);
}); });