Fix Phantom viewers' revenge

This commit is contained in:
yflory
2018-01-15 15:38:18 +01:00
parent f3d8fd3590
commit 20f05d2f6f

View File

@@ -81,6 +81,7 @@ define([], function () {
sframeChan.query('Q_RT_MESSAGE', message, function () { });
};
var firstConnection = true;
var onOpen = function(data) {
// Add the existing peers in the userList
onConnect(data.id);
@@ -88,10 +89,13 @@ define([], function () {
sframeChan.event('EV_RT_CONNECT', { myID: data.myID, members: data.members, readOnly: readOnly });
// Add the handlers to the WebChannel
padRpc.onMessageEvent.reg(function (msg) { onMessage(msg); });
padRpc.onJoinEvent.reg(function (m) { sframeChan.event('EV_RT_JOIN', m); });
padRpc.onLeaveEvent.reg(function (m) { sframeChan.event('EV_RT_LEAVE', m); });
if (firstConnection) {
firstConnection = false;
// Add the handlers to the WebChannel
padRpc.onMessageEvent.reg(function (msg) { onMessage(msg); });
padRpc.onJoinEvent.reg(function (m) { sframeChan.event('EV_RT_JOIN', m); });
padRpc.onLeaveEvent.reg(function (m) { sframeChan.event('EV_RT_LEAVE', m); });
}
};
padRpc.onDisconnectEvent.reg(function () {