Short room hashes
This commit is contained in:
parent
420db855ce
commit
580ef5a652
11
server.js
11
server.js
@ -60,10 +60,11 @@ server.listen(port, function() {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
function getRoom(socket) {
|
function getRoom(socket) {
|
||||||
if (rooms[socket.room] === undefined) {
|
var room = socket.room ? socket.room.slice(0, 6) : socket.room;
|
||||||
createRoom(socket.room);
|
if (rooms[room] === undefined) {
|
||||||
|
createRoom(room);
|
||||||
}
|
}
|
||||||
return rooms[socket.room];
|
return rooms[room];
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRoom(room) {
|
function createRoom(room) {
|
||||||
@ -164,7 +165,7 @@ io.on('connection', function(socket) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('subscribeToStream', function (data){
|
socket.on('subscribeToStream', function (data){
|
||||||
joinRoom(socket, data);
|
joinRoom(socket, data ? data.slice(0, 6) : data);
|
||||||
var room = getRoom(socket);
|
var room = getRoom(socket);
|
||||||
if (room.presenter) {
|
if (room.presenter) {
|
||||||
socket.emit('streamStarted');
|
socket.emit('streamStarted');
|
||||||
@ -172,7 +173,7 @@ io.on('connection', function(socket) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
socket.on('joinRoom', function (data) {
|
socket.on('joinRoom', function (data) {
|
||||||
joinRoom(socket, data)
|
joinRoom(socket, data ? data.slice(0, 6) : data)
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user