Okay I think I figured this out already. I *think* I'm clear on the differences between connect/disconnect and creation/expiration of channels
Basically there's no way to get notified or verify if a particular channel with ClientID has expired or not. What I did was create an Entity that stored the creation time of the channel, and every time the ClientID connects it tests for the channel age. If the channel age is over 2 hours, the server opens a new channel. If it's less than 2 hours, it just returns the token so it can be re- used. One more (and hopefully final) question: Can I be sure that the channel token will remain valid for 2 hours? Will it sometimes be less or is that a pretty precise figure? My app kind of depends on this expiration time to be relatively precise ( +/- 10 minutes) On Jul 4, 1:11 am, ksafez216 <[email protected]> wrote: > So, the Channel Presence feature actually notifies when a channel is > connected/disconnected as opposted to created/destroyed? > > If this is correct, then how can I find out when the channel that was > created on the server-side has been closed and not simply > disconnected? > > I guess I'm confused about creating vs. connecting and destroying vs. > disconnecting > > Here's what I'm doing: > > * Client requests a token using "client ID" > * If "client ID" already has a token (this info is saved in the > datastore when the channel is created server-side) THEN send the > client the token, and call channel.open(token) on client-side > * If "client ID" doesn't have a token (meaning the info doesn't exist > in the datastore), then create a new channel and send client the > token, which in turn calls channel.open(token) > * When Channel Presence detects a disconnect, delete the info stored > in the datastore (this is maybe where I've gone wrong, since the > channel is not destroyed, but simply disconnected) > > Thank you for your help. > > On Jul 3, 11:24 pm, "Nick Johnson (Google)" <[email protected]> > wrote: > > > > > Hi, > > > On Mon, Jul 4, 2011 at 3:49 PM, ksafez216 <[email protected]> wrote: > > > When I call channel.open([token]) it opens a new channel and the > > > Channel Presence feature detects this. > > > > Then, the client's browser is shut down for a few minutes and is > > > restarted. > > > > My app checks to see if they still have a valid token. If so, the > > > client calls channel.open([token]), using the same token. > > > > Again, the Channel Presence listener detects that a channel was > > > connected. > > > > Now, am I charged for two channels being open, even though it's using > > > the same client ID and token? > > > Every time you call channel.create on the server, a new channel is created, > > and a new token is returned. Billing only happens for server-side actions. > > > -Nick Johnson > > > > The thing is I don't get a channel disconnected notification, I only > > > get the two channel connected notifications. > > > > I'm just trying to figure out exactly what happens when I call > > > channel.open([token]) in the client TWICE using the same token. How > > > am I charged? > > > > -- > > > You received this message because you are subscribed to the Google Groups > > > "Google App Engine" 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/google-appengine?hl=en. > > > -- > > Nick Johnson, Developer Programs Engineer, App Engine -- You received this message because you are subscribed to the Google Groups "Google App Engine" 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/google-appengine?hl=en.
