Indeed, there is an issue with that.
The main reason why there is a challenge number is to ease some callback
on the client-side (and guaranty the request order).
I.e.
request.send('foo', {"foo:"bar"}, {callback: function(data) {
/* This is called when the server respond to this command (using the
chl to match the request) */
});
BTW, what im proposing is :
- the client send a command with "chl:1"
- the client send a command with "chl:3" <== the server keep this request
in queue until it receiv the command with the channel 2
- the client send a command with "chl:2" <== the server process this
command and the previous one
We should also add a security to avoid DOS by flooding the command queue :
- The client send a command with "chl:1"
- the client send a command with "chl:4" <= OK : Only 2 command to proceed
before release this to the queue
- the client send a command with "chl:5" <= OK ...
- the client send a command with "chl:6" <= OK
- the client send a command with "chl:7" <= FAIL => to many command in
queue
What you guys think ?
Thanks
Anthony Catel
On Wed, 10 Nov 2010 06:39:38 -0800 (PST), blueklein76
<[email protected]> wrote:
> I'm using APE with long polling, and like others on this group I've
> had intermittent problems with the BAD_CHL error. Today I managed to
> reproduce the problem reliably, and in my case it turned out to be
> caused by XHR posts being sent out of sequence, when multiple commands
> are sent to APE very quickly.
>
> Here's a trace from my browser (Safari on Mac) where the Javascript is
> sending MyCommand1 followed immediately by MyCommand2:
>
> POST [{"cmd":"CHECK","chl":
> 26,"sessid":"ddb76e52f6f9de9d048e2796856ce127"}]
> POST [{"cmd":"MyCommand2","chl":28,"params":{ "my":"data" }]
> POST [{"cmd":"MyCommand1","chl":27,"params":{ "my":"data" }]
> POST [{"cmd":"CHECK","chl":
> 29,"sessid":"ddb76e52f6f9de9d048e2796856ce127"}]
>
> As you can see, the two middle commands have been sent in the wrong
> order by the browser, the "chl" number sequence goes 26, 28, 27 and so
> the APE server returns a BAD_CHL error.
>
> Since XHR responses in the browser can return out of order, I'm
> guessing that XHR posts in the browser do not guarantee an order
> either? I've been able to fix this only because I didn't really need
> to send 2 commands at once and have removed one of them.
>
> I suspect there may be other situations (e.g. when APE starts a new
> CHECK command at the same time the client sends a different command)
> where it is possible for this to happen.
>
> Hope this helps someone else getting BAD_CHL. To the APE team - is
> there a particular reason to have this incrementing challenge number?
>
> Cheers.
--
You received this message because you are subscribed to the Google
Groups "APE Project" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/ape-project?hl=en
---
APE Project (Ajax Push Engine)
Official website : http://www.ape-project.org/
Git Hub : http://github.com/APE-Project/