Skip to content

Commit f330ca5

Browse files
committed
Fixup bfe255f
1 parent bfe255f commit f330ca5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

server-websocket.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ io.on('connection', (socket) => {
8787
// TODO: Will be solved in future https://github.com/y-js/y-websockets-server/commit/2c8588904a334631cb6f15d8434bb97064b59583#diff-e6a5b42b2f7a26c840607370aed5301a
8888
const room = decodeURIComponent(escapedRoom);
8989
console.log('User', socket.id, 'joins room:', room);
90-
socket.join(room);
91-
getInstanceOfY(decodeURIComponent(room)).then((y) => {
90+
socket.join(escapedRoom);
91+
getInstanceOfY(room).then((y) => {
9292
if (rooms.indexOf(room) === -1) {
9393
y.connector.userJoined(socket.id, 'slave');
9494
rooms.push(room);
@@ -141,12 +141,11 @@ io.on('connection', (socket) => {
141141
});
142142
});
143143
socket.on('clientCursor', (msg) => {
144-
// TODO: Will be solved in future https://github.com/y-js/y-websockets-server/commit/2c8588904a334631cb6f15d8434bb97064b59583#diff-e6a5b42b2f7a26c840607370aed5301a
145-
const room = decodeURIComponent(msg.room);
146-
if (room != null) {
144+
if (msg.room != null) {
147145
const msgCloned = clone(msg);
148146
msgCloned.id = getSha1Hash(socket.id);
149-
socket.to(msg.room).emit('clientCursor', msgCloned);
147+
// TODO: Will be solved in future https://github.com/y-js/y-websockets-server/commit/2c8588904a334631cb6f15d8434bb97064b59583#diff-e6a5b42b2f7a26c840607370aed5301a
148+
socket.to(encodeURIComponent(msg.room)).emit('clientCursor', msgCloned);
150149
}
151150
});
152151
});

0 commit comments

Comments
 (0)