Hi,
for your scenario you need:
1- connect to ape server (check configuration with the included tools)
2- js included in page : join in a channel
var client = new APE.YOURCLASS();
window.onload = function(){ client.load({ identifier:
'anIdentifier', channel: 'YOURCHAN' }); }
and in YOURCLASS in the "initialize" method catch the load event
[...] this.addEvent('load', function(){ this.core.start({'name':
'RANDOMNAME' }) } ); [...]
3- in js serverside (ape) in a default install you have the file in
"examples/nickname.js" this file catch the connect event fired by
client when this.core.start is triggered!,
you can see the code for setting attribute to the user connected!,
after the connect the user join in: 'YOURCHAN' and you can manage the
event "userJoin" and check the channel etc..
4- in you js (clientside/your page) you must send a command (when the
button is clicked ) to server with:
client.core.request.send('yourCommand', { somedata: { key:
'value' } } );
5- in js server side you must register the command (see ape hompage
the first example ) and send back to the channel (bye the pipe object)
the response like this:
Ape.registerCmd('yourCommand', true, function(params, info) {
var channel = Ape.getChannelByName('YOURCHANNEL');
if ($defined(channel)){
channel.pipe.sendRaw('yourRaw', { user: info.user.name });
}
});
6- in jsclient (your page) you must catch the raw in the 'initialize'
method of YOURCLASS, like this:
this.onRaw('yourRaw', function(raw){
//raw.data is your json data
alert('THE LAST CLICKER IS '+decodeURIComponent(raw.data.user)); //
chanche the button value or html
});
Bye :)
On Mar 25, 10:58 pm, UTAN <[email protected]> wrote:
> Hi,
>
> if you want to get the user logged who clicked the link then use
> this.core.user.properties.name
> if you are using mootools..
>
> hope understood your question.
>
> regards utan
>
> On Mar 25, 1:02 pm, Kyrie <[email protected]> wrote:
>
>
>
>
>
>
>
> > could anyone can give me a guide how to do this.. or like a tutorial..
> > because i am new with this APE..
> > the scenario :
> > when i click a button then the <div id="whoClicks">"NAME OF LAST
> > CLICKER"</div>
> > i know it's a newbie question but the documentation on the ape-
> > project.org does'nt suite what i need to learn.
> > even i read it more than a week by now i can't understand because some
> > link on the documentation is dead.
> > thanks in advance..
--
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/