Hi,
the chat demo use a feature of APE called "Session". Session allow your
application to handle multi-tab/window and page refresh. If you want to
add this feature to your application you just have to add Session.js on
the client side like that :
APE.Config.scripts.push(APE.Config.baseUrl+'/Core/Session.js'); Note :
you must add this line before call client.load();
You might have to update some little thing in your application,
(especialy connection to APE Server)
Here is a quick example :
APE.Config.scripts.push(APE.Config.baseUrl+'/Core/Session.js');//Add Session.js
var client = new APE.Client();
client.load({
'domain':APE.Config.domain,
'server':APE.Config.server,
'identifier':'chatdemo',
'channel':'test',
'complete':function(ape){ if (ape.options.restore) { //options.restore
is set to true, in case of new tab/window or refresh ape.start();//This
connect to APE and will restore the session } else {
ape.start(prompt('Please enter your nickname'));//Ask the user for his
nickname and connect to APE with the name that the user entered }
},
'scripts': APE.Config.scripts //Scripts to load for APE JSF }); You can
also check the Shoutbox demo in APE JSF
(http://github.com/APE-Project/APE_JSF/tree/master/Demos/Shoutbox/ ).
The demo already implement session handling. To enable session in this
demo just add this line before calling client.load(); in demo.html :
APE.Config.scripts.push(APE.Config.baseUrl+'/Core/Session.js');
Regards.
macer wrote:
> Hey guys,
>
> You people are doing a great job, highly appreciate it :)
> I had setup jabber server with strophe library and have dumped it
> after finding ape-project. The chat demo is exactly what I was looking
> out for but am facing one problem. My application is more like a
> shoutbox with online users list that appears on side of every page.
> Now the problem is that if I open chat/shoutbox in another tab in same
> browser it doesnt work as the nick is already taken. Its strange that
> chat demo works just fine on ape-project demo page even when its
> opened in multiple tabs and it even shares the nick. What is different
> on ape-project site which allows sharing nick names or I guess its
> sharing session!
>
> Thanks.
> >
>
--
Nicolas Trani - Développeur web
Weelya - Improve the web
32 rue du faubourg boutonnet
34090 Montpellier
Tel : 04 67 169 778
http://www.weelya.com
--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---