Glad I could help.

Do you still use the "one channel per user" technique?

Envoyé de mon iPhone

Le 2012-01-25 à 06:52, apocalys <[email protected]> a écrit :

> i solved my problem... cause was website bad manage PHP session.
> 
> On 25 Gen, 11:52, apocalys <[email protected]> wrote:
>> tkx to anwsered me...
>> 
>> i followed first method, one channel for user, but when a new user
>> login into website and join into his channel (named apeUser## where
>> '##' is userId) also all other user join into this channel and when i
>> send an inlinepush data, all user received this.
>> 
>> Here my JS code:
>> 
>> var client = new APE.Client();
>>  //1) Load APE Core
>>  client.load({
>>         identifier: 'appName',
>>         channel: 'apeuser'+userId
>>  });
>> 
>> Here my PHP code:
>> 
>> $cmd = array(array(
>>           'cmd' => 'inlinepush',
>>           'params' =>  array(
>>                   'password'  => $APEPassword,
>>                   'raw'       => 'postmsg',
>>                   'channel'=> 'apeuser'.$userIdToNotify,
>>                   'data'      => array(
>>                       'message' => $messages[0]
>>                   )
>>            )
>>         ));
>> 
>> where i wrong?
>> 
>> Tkx a lot.
>> On 24 Gen, 19:31, Louis Charette <[email protected]> wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> Hi and welcome to APE,
>> 
>>> Your PHP code looks ok, but I think Inlinepush just push the "data" to 
>>> everyone in the channel by default. To send to only one person at a time, 
>>> there's two way to do that:
>> 
>>> - Put everyone in different channel and send to the right channel with 
>>> inlinepush
>>> - Create your own server-side command based on inlinepush.
>> 
>>> The first one would be easier to do if you don't need anything else from 
>>> APE. The second one, you'll need to know the user pubid. Something like 
>>> this should work (but I didn't tested it).
>> 
>>>> Ape.registerCmd("inlinepushuser", false, function(params, infos) {
>>>>    if (params.password == Ape.config("inlinepush.conf", "password")) {
>> 
>>>>            if ($defined(params.data)) {
>> 
>>>>                    //Get user object
>>>>                    var thisUser = Ape.getUserByPubid(params.data.pubid);
>> 
>>>>                    //Send on this user raw
>>>>                    thisUser.pipe.sendRaw("inlinepushuser", {"message": 
>>>> params.data.message});
>> 
>>>>                    return {"name":"pushed","data":{"value":"ok"}};
>>>>            } else {
>>>>                    return 0;
>>>>            }
>>>>    } else {
>>>>            return ["400", "BAD_PASSWORD"];
>>>>    }
>> 
>>>> });
>> 
>>> And your php code become this:
>> 
>>>> $cmd = array(array(
>>>>      'cmd' => 'inlinepushuser',
>>>>      'params' =>  array(
>>>>              'password'  => $APEPassword,
>>>>              'raw'       => 'postmsg',
>>>>              'channel'=> 'testchannel',
>>>>              'pipe'   => '593bbc59403c9289e1e2728882a0f1ea',
>>>>              'data'      => array( //Note: data can't be a string
>>>>                  'message' => $messages[0],
>>>>                       'pubid' => $userpubid
>>>>              )
>>>>       )
>>>>    ));
>> 
>>> But again, putting everyone in different channel should be easier, 
>>> depending of what you want to achieve.
>> 
>>>   - Louis
>> 
>>> Le 2012-01-24 à 06:05, apocalys a écrit :
>> 
>>>> Hi all...
>> 
>>>> I new to develop in APE and I need to create a user notify system into
>>>> a web site.
>>>> I don't understand how to send an inlinepush data to a single user and
>>>> not to all.
>> 
>>>> To allow this user have to join in a channel on core.start or not?
>> 
>>>> My PHP code to send data is:
>> 
>>>>        $APEserver = 'http://domain:6969/?';
>>>>    $APEPassword = #psw#;
>> 
>>>>    $messages = array(
>>>>            'Notify'
>>>>    );
>> 
>>>>    $cmd = array(array(
>>>>      'cmd' => 'inlinepush',
>>>>      'params' =>  array(
>>>>              'password'  => $APEPassword,
>>>>              'raw'       => 'postmsg',
>>>>              'channel'=> 'testchannel',
>>>>              'pipe'   => '593bbc59403c9289e1e2728882a0f1ea',
>>>>              'data'      => array( //Note: data can't be a string
>>>>                  'message' => $messages[0]
>>>>              )
>>>>       )
>>>>    ));
>> 
>>>>    $data =
>>>> file_get_contents($APEserver.rawurlencode(json_encode($cmd)));
>>>>    return var_dump(json_decode($data));
>> 
>>>> APE server tell me that message was pushed correctly but i can't get
>>>> it.
>> 
>>>> Login into website with 2 different user I get, for all 2, the same
>>>> pubId... is this the problem?
>> 
>>>> I have to sent inlinepush to pubId or sessionId?
>> 
>>>> Tkx to all
>> 
>>>> --
>>>> 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