Fix Phantom viewers' revenge

pull/1/head
yflory 7 years ago
parent f3d8fd3590
commit 20f05d2f6f

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

Loading…
Cancel
Save