mirror of
https://github.com/RobinLinus/snapdrop.git
synced 2025-05-20 09:30:19 -07:00
Keep connections alive
This commit is contained in:
parent
3b4784e8eb
commit
00aa38564c
@ -23,7 +23,6 @@
|
||||
}.bind(this);
|
||||
},
|
||||
initialize: function() {
|
||||
if (window.isActive) {
|
||||
clearInterval(this.reconnectTimer);
|
||||
this.reconnectTimer = undefined;
|
||||
var options;
|
||||
@ -65,7 +64,6 @@
|
||||
return;
|
||||
}
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
connect: function(c) {
|
||||
|
@ -9,23 +9,12 @@
|
||||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
window.isActive = true;
|
||||
|
||||
window.onfocus = function() {
|
||||
window.isActive = true;
|
||||
};
|
||||
|
||||
window.onblur = function() {
|
||||
window.isActive = false;
|
||||
};
|
||||
|
||||
Polymer({
|
||||
is: 'web-socket',
|
||||
attached: function() {
|
||||
this.init();
|
||||
},
|
||||
init: function() {
|
||||
if (window.isActive) {
|
||||
clearInterval(this.reconnectTimer);
|
||||
this.reconnectTimer = undefined;
|
||||
var websocketUrl = (window.debug ? 'ws://' + window.location.hostname + ':3002' : 'wss://snapdrop.net') + '/binary';
|
||||
@ -70,7 +59,6 @@
|
||||
this.client.on('close', function(e) {
|
||||
this._reconnect(e);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
_sendFile: function(toPeer, file) {
|
||||
console.log('send file via WebSocket', file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user