handle socketio reconnect situation

This commit is contained in:
Connor Turland 2015-12-22 18:05:13 -05:00
parent 64283850e3
commit 5ad1504494
2 changed files with 11 additions and 2 deletions

View file

@ -1918,6 +1918,7 @@ Metamaps.Realtime = {
webrtc: null,
readyToCall: false,
mappersOnMap: {},
disconnected: false,
chatOpen: false,
status: true, // stores whether realtime is True/On or False/Off,
broadcastingStatus: false,
@ -1943,7 +1944,12 @@ Metamaps.Realtime = {
self.socket = new SocketIoConnection({ url: whichToConnect });
self.socket.on('connect', function () {
console.log('connected');
if (!self.disconnected) {
self.startActiveMap();
} else self.disconnected = false;
});
self.socket.on('disconnect', function () {
self.disconnected = true;
});
if (Metamaps.Active.Mapper) {
@ -2171,7 +2177,7 @@ Metamaps.Realtime = {
var self = Metamaps.Realtime;
self.webrtc.off('readyToCall');
self.webrtc.on('readyToCall', function () {
self.webrtc.once('readyToCall', function () {
self.videoInitialized = true;
self.readyToCall = true;
self.localVideo.view.$container.show();

View file

@ -110,6 +110,9 @@
background: url(<%= asset_path 'junto.png' %>) no-repeat 2px 9px, url(<%= asset_path 'tray_tab.png' %>) no-repeat;
cursor: pointer;
}
.chat-box .chat-button.active {
background: url(<%= asset_path 'junto.gif' %>) no-repeat 2px 9px, url(<%= asset_path 'tray_tab.png' %>) no-repeat !important;
}
.chat-box .chat-button .chat-unread {
display: none;
background: #DAB539;