mirror of
https://github.com/fergalmoran/chrometophone.git
synced 2025-12-22 09:41:51 +00:00
Reconnect on error
This commit is contained in:
@@ -118,7 +118,6 @@ function initializeBrowserChannel(callback) {
|
|||||||
if (req.status == 200) {
|
if (req.status == 200) {
|
||||||
var channelId = req.responseText.substring(3).trim(); // expect 'OK <id>';
|
var channelId = req.responseText.substring(3).trim(); // expect 'OK <id>';
|
||||||
channel = new goog.appengine.Channel(channelId);
|
channel = new goog.appengine.Channel(channelId);
|
||||||
console.log('Attempting to open ' + channelId);
|
|
||||||
socket = channel.open();
|
socket = channel.open();
|
||||||
socket.onopen = function() {
|
socket.onopen = function() {
|
||||||
console.log('Browser channel initialized');
|
console.log('Browser channel initialized');
|
||||||
@@ -134,7 +133,7 @@ function initializeBrowserChannel(callback) {
|
|||||||
console.log('Browser channel token expired - reconnecting');
|
console.log('Browser channel token expired - reconnecting');
|
||||||
} else {
|
} else {
|
||||||
console.log('Browser channel error');
|
console.log('Browser channel error');
|
||||||
// Automatically reconnects
|
setTimeout('initializeBrowserChannel()', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
socket.onmessage = function(evt) {
|
socket.onmessage = function(evt) {
|
||||||
|
|||||||
Reference in New Issue
Block a user