Revert "This patch hangs the server." (the websockets live query code)

I accidentally committed this earlier, but it was still a WIP.

This reverts commit aef2fba3e1.
This commit is contained in:
Brad Fitzpatrick 2013-12-12 11:38:01 +04:00
parent a0576f2c0d
commit fc4d26ad3b
1 changed files with 4 additions and 23 deletions

View File

@ -307,7 +307,7 @@ camlistore.BlobItemContainer.prototype.search = function(callerConstraint,
thumbnailSize: this.thumbnailSize_
},
sort: 1, // LastModifiedDesc
limit: 30,
limit: 50,
constraint : {
logical: {
op: 'and',
@ -323,28 +323,9 @@ camlistore.BlobItemContainer.prototype.search = function(callerConstraint,
}
};
var callback = goog.bind(this.searchDone_, this, callerConstraint,
!isContinuation);
if (window.WebSocket) {
var uri = new goog.Uri(goog.uri.utils.appendPath(
this.connection_.config_.searchRoot, 'camli/search/ws'));
uri.setDomain(location.hostname);
uri.setPort(location.port);
uri.setScheme("ws");
var ws = new WebSocket(uri.toString());
ws.onopen = function() {
var message = {
tag: 'q1',
query: query
};
ws.send(JSON.stringify(message));
};
ws.onmessage = function(e) {
callback(JSON.parse(e.data).result);
}.bind(this);
} else {
this.connection_.search(JSON.stringify(query), callback);
}
this.connection_.search(JSON.stringify(query),
goog.bind(this.searchDone_, this, callerConstraint,
!isContinuation));
};
camlistore.BlobItemContainer.prototype.searchDone_ = function(constraint,