Reeves Keanu a écrit :
(Sorry about I'm not good at english.)

First, thank you for making powerful push ajax framework APE.
And hope to be best solution for web 2.0



I'm trying to force user to left the channel when browser closed or
refreshed.
look at this code. (I referrenced color-change demo.)

****** Client Side ***********
window.onbeforeunload = function()
{
        // send sever 'userLeave' command.
        pipe.request.send('userLeave', {'foo': 'bar'});
}

****** Server Side **********
Ape.registerCmd('userLeave', true, function(user, infos) {
        // get channel object
        var channel = Ape.getChannelByPubid(user.pipe);
        if(channel) {
                // this results server error...
                user.left(channel.getProperty('name'));
        } else {
                return ['401', 'UNKNOWN_CHANNEL'];
        }
});




OS - CentOS 5.4
I added server side command 'userLeave' however when server received
'userLeave' cmd, server says "/var/ape/color.js:46:TypeError :
user.left is not a function".

How can I use user.left.
plz help me :)

Hi,

Arguments to the registerCmd callback are wrong : http://www.ape-project.org/docs/server/commands/registercmd.html

i.e.
Ape.registerCmd('foo', true, function(params, cmd) { cmd.user.left(channel) });


Anthony C.

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