Created
July 18, 2019 05:35
-
-
Save efossas/6e49e70d5ccc5aad757629936a09d851 to your computer and use it in GitHub Desktop.
Socket Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
eventName: Check | |
data: any | |
*/ | |
const Check = (socket) => { | |
socket.on('Check', (data) => { | |
socket.emit('Check', data); | |
}); | |
}; | |
/* | |
eventName: JoinRoom | |
data: [ROOM_UUID, ...] | |
*/ | |
const JoinRoom = (socket) => { | |
socket.on('JoinRoom', (data) => { | |
console.info('joining: ' + data); | |
for (let uuid of data) { | |
socket.join(uuid); | |
} | |
}); | |
}; | |
/* | |
eventName: LeaveRoom | |
data: [ROOM_UUID, ...] | |
*/ | |
const LeaveRoom = (socket) => { | |
socket.on('LeaveRoom', (data) => { | |
console.info('leaving: ' + data); | |
for (let uuid of data) { | |
socket.leave(uuid); | |
} | |
}); | |
}; | |
module.exports = { | |
Check: Check, | |
JoinRoom: JoinRoom, | |
LeaveRoom: LeaveRoom | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment