Skip to content

Commit

Permalink
Force connection closure every 15 seconds to overcome heroku loadbala…
Browse files Browse the repository at this point in the history
…ncer issues.
  • Loading branch information
majek committed Nov 3, 2011
1 parent 63c8826 commit 6485399
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions gateway/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,20 @@ sjs.on('open', function(s) {
s.send(msg);
};
console.log(id + " created");
var t = setInterval(function(){
try{
s.conn._session.recv.didClose();
} catch (x) {
}
}, 15000);
s.on('message', function(e) {
conn.publish('mud', {data: e.data,
'reply-to': 'mud-' + client_id,
id: id});
});
s.on('close', function() {
clearInterval(t);
t = null;
conn.publish('mud', {data: '',
closed: true,
'reply-to': 'mud-' + client_id,
Expand Down

0 comments on commit 6485399

Please sign in to comment.