Integrate keepalives into websocket resources
This commit is contained in:
parent
7d2b41db11
commit
cd363bd84d
6 changed files with 116 additions and 118 deletions
|
@ -42,14 +42,15 @@
|
|||
eventTarget.dispatchEvent(ev);
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
this.wsr = new WebSocketResource(this.socket, this.handleRequest.bind(this));
|
||||
this.keepalive = new KeepAlive(this.wsr);
|
||||
this.wsr = new WebSocketResource(this.socket, this.handleRequest.bind(this), {
|
||||
keepalive: { path: '/v1/keepalive', disconnect: true }
|
||||
});
|
||||
|
||||
},
|
||||
handleRequest: function(request) {
|
||||
this.keepalive.reset();
|
||||
this.wsr.resetKeepAliveTimer();
|
||||
// TODO: handle different types of requests. for now we only expect
|
||||
// PUT /messages <encrypted IncomingPushMessageSignal>
|
||||
textsecure.crypto.decryptWebsocketMessage(request.body).then(function(plaintext) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue