@julien,

It seems I am not able to get the parameters passed too the serverside
javascript.

heren is a piece of my code
function InitializeHighscore( sIdentifier, sChannel, sUsername, nUserId,
sKey ){

client.load({'identifier':''+sIdentifier+'','channel':''+sChannel+'','userid':''+nUserId+'','friends':'[2]'});

    client.addEvent('load', function(){
        if (client.core.options.restore) {
            //Calling start(); without arguments will ask the APE Server for
a user session
            client.core.start();
        } else {
            client.core.start({'name':''+sUsername+''});
        }
    });

is this correct? the params var on the server side js does not come up with
my userid and friends

2011/6/7 Ronnie Visser <[email protected]>

> @pablo,
>
> At this moment all user connect to the same channel, I was just searching
> for a way to fix my problem.
>
> @julien
> Thnx, I will take a look at this tonight, I really hope I can solve this
> problem now :) it is given me sleepless nights at this moment
>
> I will let you know if I get this fixed
>
> 2011/6/7 Julien TAGNERES <[email protected]>
>
>> Hi,
>>
>> I guess every user in your database have a list of friends with their
>> "id".
>> The easiest way for you would be to pass two parameters when you connect
>> to APE, this way :
>> { id: #userId, friends: [#idFriend1, #idFriend2 ... ], otherParams... }
>> in Ape, you would then use
>> user.setProperty('id', params.id);
>> and
>> user.friends = friends;
>> (I don't use setProperty for json and arrays since it proven to return
>> strange values with getProperty at the beginning, I didn't test in latest
>> versions though).
>> Then... all you users should join a channel named "general" or...
>> anything.
>>
>> This function could be usefull :
>> function in_array(item, array) {
>>     for(var i = 0; i < array.length; i++) {
>>         if(array[i] == item) return true;
>>     }
>>     return false;
>> }
>>
>> To send a message to all your friends, you would then have to parse this
>> userlist.
>>
>> var chan = Ape.getChannelByName('general');
>> chan.userslist.each(function(user) {
>>     if(in_array(user.getProperty('id'), info.user.friends)) {
>>         user.pipe.sendRaw('message', { from: info.user.getProperty('id'),
>> content: params.message });
>>     }
>> });
>>
>> This way, users will only receive your message if they belong to your
>> friends list.
>> I assumed that you would use params and info as parameters of the callback
>> function binded to your message command.
>>
>> Regards, Julien.
>>
>> 2011/6/7 RonnieV <[email protected]>
>>
>>> Hi,
>>>
>>> First of all, I know that APE doesn't deal with users that are
>>> registered on your site.
>>>
>>> What I want is when I send a message to the ape server only my friends
>>> get notified, currently I am using inlinepush but when a message has
>>> been send every body get's notified. At this moment I filter my
>>> friends with client side javascript en only notify them, but if you
>>> have something like firebug you can see the message even if you are
>>> not my friend on my site.
>>>
>>> What should i do to create a system like mentioned above? should I
>>> send all of my friends userid's with the request and give every user a
>>> specific channel? for instance there userid? and then send the
>>> messages only to the channels that are given as a userid?.
>>>
>>>
>>> Hope someone can answer my question
>>>
>>> Regards, Ronnie
>>>
>>> --
>>>
>>> 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/
>>>
>>
>>  --
>> 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/
>>
>
>

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