We have a web site, iphone and android app. We need to be able to push messages to the same user on each of these platforms at the same time, and we need the ability to directly address a user from our application. I found it difficult to reconstruct sessions, and because I didn't control the creation of the pubid, I couldn't send messages to arbitrary uses just knowing their user id.
So I implemented it as follows: Each user has a channel generated for him to listen for commands on (we have our own custom JSON commands for various events on the site). The channel name is an md5 hash of his user id and a secret key, so I know the channel name of any user just by his user id and the site secret key. When a client connects to APE, it joins this user channel. Multiple APE users (iphone, droid, web) can all be listening on the same user channel, and will receive events. If another user wants to send an event to a user, such as a chat etc. he joins the user's channel and sends events on it. The other user joins the sending user's channel and sends replies on it. This allows us capture events like when the user leaves the chat, etc. Any comments you have on this would be welcome. On Tue, Jul 20, 2010 at 3:04 PM, <[email protected]> wrote: > Hi, > > - You can use a POST instead a GET (APE understand both of them) > No there is not really a perfomance undermine using channel. > > How it works internally : > > - If you send a message to a channel which broadcast the message to > multiple user, the server do a "zero copy" : the message is not duplicated > in memory. > - If you send the same message to several users : the message is > duplicated => more memory usage > > Can you explain me more precisely how your whole application works ? So > that I can imagine a better design. > > Anthony > > On Tue, 20 Jul 2010 14:37:24 -0400, Johnathan Leppert > <[email protected]> wrote: > > Hi Anthony, > > Thanks for your response. Basically what I am doing is creating a new > > channel for each user (random hash), via my site framework. I don't make > > use of APE sessions at all; instead I just join the user to this > channel. > > So the same user on my site has different APE sessions, but are both > > subscribed to the same general purpose "user channel". They then can > > receive messages on this channel that I've created, and send messages to > > other users via the site framework (that knows how to generate the > > channel hash from a user id). To send messages to APE from my > > application, I'm using the inline push. It seems to work ok, despite > > having an odd transport (why not POST instead of url encoded GET > > params?). > > I'm just wondering if there are any performance concerns with having > > many channels (1 per user). I am guessing channels are handled similar > to > > user pipes, so it shouldn't be a big deal? > > The issue I came across with APE sessions is that I have a need to > > supply the session id from my application, and get back something that I > > can identify the APE user with and communicate with him, such as his > > pubid. That way, I can send messages to users from my application, and > > users can communicate between themselves using the APE server, without > > having to involve my application. > > If you could make this any easier, for people already with a user system > > that would be great! > > Thanks, > > Johnathan > > On Tue, Jul 20, 2010 at 1:51 PM, wrote: > > Hey, > > > > Sorry for my late response ;) > > > > 1. Yes indeed in not really reliable. I guess that you are using > > "inlinepush.js" to do that. Inlinepush.js is just a sample, you can > > write > > yourself something to allow a request to send a message to a specific > > user > > (user.pipe.sendRaw()). > > > > 2. Im working on that feature, there is no way to "hack" this in a > > clean > > way. > > > > Anthony > > > > On Sun, 18 Jul 2010 09:33:03 -0700 (PDT), leppert > > wrote: > > > - How do you send a message to a specific user on his/her pipe from > > > your application (PHP, etc.)? For example, I want to send the user an > > > updated e-mail count. How would you suggest to do this? Join the user > > > to a specific user channel and push messages on it? It seems counter > > > intuitive. > > > > > > - How do you resume a session from two different locations? For > > > example, say I have the same user and he logs in at both home and > > > work, using his browser. How do you ensure that he gets his same > > > unipipe/pubid. The session management seems to only work with > > cookies, > > > which is fine. But you can't join the same user, or somehow create a > > > duplicate user session. > > > > > > My goal was to somehow capture the user's session id and/or his pubid > > > in my database upon the user create event, and then both use this in > > > my application to send the user events, and to allow the same user to > > > be logged in at multiple locations and multiple platforms (e.g. > > > iphone). > > > > > > Any help or insight is appreciated. > > > > > > Thank you, > > > > > > Johnathan > > > > -- > > 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] [3] > > To unsubscribe from this group, send email to > > > > [email protected]<ape-project%[email protected]>[4] > > For more options, visit this group at > > http://groups.google.com/group/ape-project?hl=en [5] > > --- > > APE Project (Ajax Push Engine) > > Official website : http://www.ape-project.org/ [6] > > Git Hub : http://github.com/APE-Project/ [7] > > > > -- > > 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]<ape-project%[email protected]> > > For more options, visit this group at > > http://groups.google.com/group/ape-project?hl=en [8] > > --- > > APE Project (Ajax Push Engine) > > Official website : http://www.ape-project.org/ [9] > > Git Hub : http://github.com/APE-Project/ [10] > > > > > > Links: > > ------ > > [1] mailto:[email protected] > > [2] mailto:[email protected] > > [3] mailto:[email protected] > > [4] > > mailto:ape-project%[email protected]<ape-project%[email protected]> > > [5] http://groups.google.com/group/ape-project?hl=en > > [6] http://www.ape-project.org/ > > [7] http://github.com/APE-Project/ > > [8] http://groups.google.com/group/ape-project?hl=en > > [9] http://www.ape-project.org/ > > [10] 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]<ape-project%[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/
