Include original peer in socket broadcast

auto_join_3.3
Håvar Aambø Fosstveit 2020-03-23 22:57:18 +01:00
parent 764e02c732
commit 013abb15ba
1 changed files with 6 additions and 3 deletions

View File

@ -430,7 +430,7 @@ class Room extends EventEmitter
this._notification(peer.socket, 'gotRole', {
peerId : peer.id,
role : newRole
}, true);
}, true, true);
});
peer.on('lostRole', ({ oldRole }) =>
@ -443,7 +443,7 @@ class Room extends EventEmitter
this._notification(peer.socket, 'lostRole', {
peerId : peer.id,
role : oldRole
}, true);
}, true, true);
});
}
@ -1361,13 +1361,16 @@ class Room extends EventEmitter
});
}
_notification(socket, method, data = {}, broadcast = false)
_notification(socket, method, data = {}, broadcast = false, includeSender = false)
{
if (broadcast)
{
socket.broadcast.to(this._roomId).emit(
'notification', { method, data }
);
if (includeSender)
socket.emit('notification', { method, data });
}
else
{