On Sep 15, 2:23 pm, Pablo Tejada <[email protected]> wrote:
> Just curious, are you using these scheme?

Below is my Javascript. It's based off of the sessions tutorial
(http://www.ape-project.org/wiki/index.php/Tutorial:Using_sessions).

var user_id = "8486bd4e-ddb5-11e0-9f35-0026bb1b90cc";
var client = new APE.Client();
client.load({'identifier': 'myapp', 'channel':'messages-'+user_id});
client.addEvent('load', function(){
    console.log('loading ape...')
    if (client.core.options.restore) {
        client.core.start();
    } else {
        client.core.start({'name':''});
    }
});
client.addEvent('ready', function(){
    console.log('ape ready')
    if (client.core.options.restore) {
        //If it's a session restoration, ask the APE server for the
custom session 'key1'
        client.core.getSession('user_id', function(resp) {
            console.log('Receiving sessions data. key1 value is : ',
resp.data.sessions.user_id);
        });
    } else {
        //Saving custom session key1 one the server
        console.log('saving custom session data, key1 on the server');
        client.core.setSession({'user_id':user_id});
    }

    var channel = 'messages-'+user_id;
    console.log("joining channel:"+channel);
    client.core.join(channel);
    //client.core.request.send('JOIN', {'channel':channel});

    client.onRaw('data', function(raw, pipe) {
        console.log('received:' + unescape(raw.data.msg));
    });

    client.onRaw('postmsg', function(raw, pipe) {
        console.log('postmsg:'+raw)
        //add_history(raw.data.text, false);
    });

});

I believe the line "client.core.join(channel);" is now giving me the
error response:

Ape.transport.read('[{"time":"1316112102","raw":"ERR","data":
{"code":"202","value":"CANT_JOIN_CHANNEL"}}]')

Are there any restrictions to channel names? Or do I have to somehow
create the channel first?

Chris

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