Well maybe I'm doing it wrong.
All my settings are default, except I'm using JSONP transport instead of
default Long Polling for cross-site support.
Here's my code, pulled straight from "hello world" example:
var APEclient;
> var queuePubid;
>
> window.onload = function() {
> APEclient = new APE.Client();
> APEclient.load();
> APEclient.addEvent('load', function() {
> APEclient.core.start({'name':'WesG'}); //connect to APE server with this
> username
> });
> APEclient.addEvent('ready', function() {
>
> //this event only fires when you first load the page. If you press F5 or
> reload page,
> //it doesn't fire because the pipe was
> already created last time
> APEclient.addEvent('multiPipeCreate',
> function(pipe, options) {
> queuePubid = pipe.getPubid(); //queuePubid has a global scope
> });
> //this event only fires when you first
> load the page. If you press F5 or reload page, it doesn't fire
//APEclient.core.addEvent('userJoin', function (user, pipe) {
> // queuePubid = pipe.getPubid();
> //});
> APEclient.core.join('scratch_queue');
> APEclient.onRaw('data', function(raw, pipe) {
> alert(unescape(raw.data.msg));
> });
> });
> }
> function apeSend() {
> APEclient.core.getPipe(queuePubid).send(prompt('Message to send : ?'));
> }
I'm just testing with two computers by clicking a button like this:
> <input type='button' title='Click here to send a message' value='APE
> Message' style='color:black;' onclick='apeSend();'>
Everything works great, and I can send messages back and forth over and
over again...
...until I click "refresh" or hit F5 on one of the browsers, then the
messages aren't sent anymore.
This is because I can't get the pubid in order to access the pipe, because
the multiPipeCreate event only fires when you create the pipe, but if you
refresh the page, APE server knows that this user is already joined to the
pipe, so it doesn't need to be created again.
I'm not using sessions, as far as I know, unless sessions are automatically
used by default.
Is there any other way to access a pipe that already exists after you
refresh your browser?
Thanks so much for taking the time to help me.
-Wes
--
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/