Skip to content

Commit f44a81b

Browse files
committed
yes toggele, mouse change, fix div bug, fix host bug, No black mouse fix, no txt change
2 parents f58b6b7 + c31003c commit f44a81b

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

app/src/components/left/RoomsContainer.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ import {
5757
DeleteContextPayload,
5858
addComponentToContext
5959
} from '../../../src/redux/reducers/slice/contextReducer';
60-
import Canvas from '../../components/main/Canvas';
6160

6261
// // for websockets
6362
// // Part - join room and room code functionality

app/src/components/main/Canvas.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,9 @@ function Canvas(props: {}): JSX.Element {
231231
contextParam: contextParam
232232
});
233233

234-
console.log('emit addChildAction event is triggered in canvas');
234+
console.log(
235+
`emit addChildAction event is triggered in canvas from ${socket.id}`
236+
);
235237
}
236238
} else if (item.newInstance && item.instanceType === 'Component') {
237239
let hasDiffParent = false;

app/src/helperFunctions/socket.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ import config from '../../../config';
44
let socket = null;
55

66
export const initializeSocket = () => {
7-
if (socket) socket.connect();
8-
if (!socket) {
9-
socket = io(config.API_BASE_URL, { transports: ['websocket'] });
10-
console.log('A user connected');
11-
console.log('socket:', socket);
12-
}
7+
socket = io(config.API_BASE_URL, {
8+
transports: ['websocket'],
9+
// will force new socket connection if re-joining to prevent double emits
10+
forceNew: true
11+
});
12+
console.log('A user connected');
13+
console.log('socket:', socket);
14+
// }
1315
};
1416

1517
// export socket to ensure a single socket instance across the entire app

server/server.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ io.on('connection', (client) => {
182182
if (roomCode) {
183183
//server send the data to everyone in the room
184184
client.to(roomCode).emit('child data from server', childData);
185+
console.log(`client id: ${client.id} sending from server ${childData}`);
185186
}
186187
});
187188

0 commit comments

Comments
 (0)