Skip to content

Commit 6485399

Browse files
committed
Force connection closure every 15 seconds to overcome heroku loadbalancer issues.
1 parent 63c8826 commit 6485399

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

gateway/server.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,20 @@ sjs.on('open', function(s) {
4545
s.send(msg);
4646
};
4747
console.log(id + " created");
48+
var t = setInterval(function(){
49+
try{
50+
s.conn._session.recv.didClose();
51+
} catch (x) {
52+
}
53+
}, 15000);
4854
s.on('message', function(e) {
4955
conn.publish('mud', {data: e.data,
5056
'reply-to': 'mud-' + client_id,
5157
id: id});
5258
});
5359
s.on('close', function() {
60+
clearInterval(t);
61+
t = null;
5462
conn.publish('mud', {data: '',
5563
closed: true,
5664
'reply-to': 'mud-' + client_id,

0 commit comments

Comments
 (0)