Hi,

Each 25sec, you have to open a new CHECK request to APE Server. When you send a new request, the previous running request will receive the CLOSE raw.

Also you might be interested in using transport method 6 (websocket) with last APE git (instead of long polling), allowing you to have a full duplex connection to APE Server.

Regards.

On 19/05/2010 11:19, Michiel Prins wrote:
Hi,

I'm writing an iPhone client in Objective-C to communicate with the
APE server (real-time chat example). I used Firefox with Firebug to
check out the communication between the web browser and the APE server
in JSON format (the info on the wiki doesn't fully apply on the real-
time chat example with channel and session support).

The first request:
[{"cmd":"CONNECT","chl":1,"params":{"name":"Michiel"}},
{"cmd":"JOIN","chl":2,"params":{"channels":"testChannel"}}]

APE server responds:
[{"time":"1274259299","raw":"LOGIN","data":
{"sessid":"ff7876da9f6d3ea9c84d0510f5f44fc9"}},
{"time":"1274259299","raw":"IDENT","data":{"user":
{"casttype":"uni","pubid":"49826c351f9b49b785ae0255daf8017b","properties":
{"name":"GERT"}}}},{"time":"1274259299","raw":"CHANNEL","data":
{"users":
[{"casttype":"uni","pubid":"49826c351f9b49b785ae0255daf8017b","properties":
{"name":"Michiel"},"level":1}],"pipe":
{"casttype":"multi","pubid":"163d8c9f290d81b6dbb336f7755dd3e4","properties":
{"name":"testchannel"}}}}]

The session ID from the first server response is used to send the next
CHECK command with HTTP header Connection: Keep-Alive.

The second request:
[{"cmd":"CHECK","chl":3,"sessid":"ff7876da9f6d3ea9c84d0510f5f44fc9"}]

If some event happens in the upcoming 25 seconds after sending the
CHECK command (e.g. LEFT, JOIN or someone who broadcasts a message in
the channel) the APE server responds with the raw response. Example:

[{"time":"1274259307","raw":"JOIN","data":{"user":
{"casttype":"uni","pubid":"4ce6a7087e4fddae7e8d801e296e5af0","properties":
{"name":"Firefox"}},"pipe":
{"casttype":"multi","pubid":"163d8c9f290d81b6dbb336f7755dd3e4","properties":
{"name":"testchannel"}}}}]

Until now it's all working OK. But when there's no event in the 25
seconds after the CHECK command, the server responds with an error
which keeps telling me my session ID is wrong (BAD_SESSID). While
using FireFox I'm not encountering this problem (server responds with
CLOSE).

Does anyone know in which way my custom client differs from what the
web browser does, which could lead to the BAD_SESSID error?

Thanks.



--
Nicolas Trani - Web engineer
Weelya - Improve the web
32 rue du faubourg boutonnet
34090 Montpellier
http://www.weelya.com
http://www.ape-project.org

--
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/

Reply via email to