use a websocket which automatically reconnects if the connection is lost

This commit is contained in:
Caleb James DeLisle
2014-11-04 10:51:53 +01:00
parent e3a54c11ee
commit 0d3ded68a0
4 changed files with 39 additions and 46 deletions

View File

@@ -649,7 +649,6 @@ var sync = function (realtime) {
};
var getMessages = function (realtime) {
if (realtime.registered === true) { return; }
realtime.registered = true;
/*var to = schedule(realtime, function () {
throw new Error("failed to connect to the server");
@@ -1135,6 +1134,7 @@ module.exports.create = function (userName, authToken, channelId, initialState,
}),
start: enterChainPad(realtime, function () {
getMessages(realtime);
if (realtime.syncSchedule) { unschedule(realtime, realtime.syncSchedule); }
realtime.syncSchedule = schedule(realtime, function () { sync(realtime); });
}),
abort: enterChainPad(realtime, function () {