mirror of
https://github.com/schlagmichdoch/PairDrop.git
synced 2025-04-20 15:06:15 -04:00
Keep connections alive
This commit is contained in:
parent
3b4784e8eb
commit
00aa38564c
2 changed files with 80 additions and 94 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue