work in progress: Dojo client for talk protocol with long-poll transport

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3848 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-05-04 10:29:46 +00:00
parent c4a0d2a6d2
commit 6625abe012

View file

@ -32,6 +32,7 @@ dojo.declare('jocy.talk.Connection', null, {
this.connected = false;
this.receiver = null;
this.receiving = false;
this.repeat_receiving = false;
this.id = (name == undefined | name == '' ? null : name);
},
@ -49,11 +50,12 @@ dojo.declare('jocy.talk.Connection', null, {
});
},
receive: function(timeout) {
receive: function(repeat) {
if (this.receiving) {
return;
}
this.receiving = true;
this.repeat_receiving = repeat;
return dojo.xhrPost({
url: this.url + '/.talk/receive/' + this.id,
handleAs: 'json',
@ -82,7 +84,7 @@ dojo.declare('jocy.talk.Connection', null, {
error: dojo.hitch(this, this._handleError),
load: dojo.hitch(this, function(response, ioArgs) {
console.log(response);
this.receiving = false;
this.repeat_receiving = false;
})
});
},
@ -95,7 +97,9 @@ dojo.declare('jocy.talk.Connection', null, {
return;
}
this.receiving = false;
st = response.state;
if (this.repeat_receiving) {
receive(true);
}
},
_handleReceiveError: function(response, ioArgs) {