1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-19 16:42:09 +03:00

Merge branch 'develop' into push

Conflicts:
	lib/client.js
This commit is contained in:
David Baker
2015-06-26 16:39:32 +01:00
6 changed files with 135 additions and 8 deletions

View File

@@ -54,8 +54,6 @@ function MatrixClient(opts) {
return _sendEventHttpRequest(self, eventToSend);
});
}
// track our position in the overall eventstream
this.fromToken = undefined;
this.clientRunning = false;
var httpOpts = {
@@ -1025,7 +1023,7 @@ function doInitialSync(client, historyLen) {
}
if (data) {
client.fromToken = data.end;
client.store.setSyncToken(data.end);
var events = [];
for (i = 0; i < data.presence.length; i++) {
events.push(new MatrixEvent(data.presence[i]));
@@ -1071,7 +1069,7 @@ MatrixClient.prototype.startClient = function(historyLen) {
// client is already running.
return;
}
if (this.fromToken) {
if (this.store.getSyncToken()) {
// resume from where we left off.
_pollForEvents(this);
return;
@@ -1102,7 +1100,7 @@ function _pollForEvents(client) {
}, 40000);
client._http.authedRequest(undefined, "GET", "/events", {
from: client.fromToken,
from: client.store.getSyncToken(),
timeout: 30000
}).done(function(data) {
if (discardResult) {
@@ -1167,7 +1165,7 @@ function _pollForEvents(client) {
});
}
if (data) {
self.fromToken = data.end;
self.store.setSyncToken(data.end);
utils.forEach(events, function(e) {
self.emit("event", e);
});