Skip to content

Commit

Permalink
keep up to one socket alive
Browse files Browse the repository at this point in the history
  • Loading branch information
atwayne committed Jan 9, 2014
1 parent daf613c commit f7f21ff
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/static/js/page.room.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ $(document).ready(function(){
});

});


if(page.room.socket!=undefined){
page.room.socket.close();
}
var token = $('#parameters').data('channeltoken');
var channel = new goog.appengine.Channel(token);
var socket = channel.open();
page.room.socket = socket;

socket.onmessage = function(data){
var message = JSON.parse(data.data);
Expand Down

0 comments on commit f7f21ff

Please sign in to comment.