[google-appengine] Re: Channel use/reuse question
Hello Richard, I had the same problem and could only resolve it by generating a new token for the reconnecting user, i.e. calling create_channel again. You can use the same user id though. I believe I read in the docs somewhere that a token is only good for one sustained connection, afterwards it's discarded. BR // Fredrik On May 12, 1:57 pm, Richard Arrano wrote: > Hello, > I've been using the Channel API and for each chat room, I have a fixed > number of users. So for each room, prior to the launch, I call > create_channel for each user and store it in a dictionary that I save > in a TextProperty. When I want to broadcast, I read the TextProperty > and convert it back to a dictionary, then call channel.send_message on > each. This works well initially. However, when a user exits the > session and comes back, it invariably causes this error each time: > > File "C:\Program Files\Google\google_appengine\google\appengine\api > \channel\channel_service_stub.py", line 127, in > _Dynamic_SendChannelMessage > self._channel_messages[client_id].append(request.message()) > KeyError: '21024-21026-185804764220139124118' > > Where the first two numbers are some identifiers and the last part is > the user id. Does something get "used up" so to speak when the client > opens the initial connection? I've seen people suggesting reusing > tokens instead of calling create_channel each time, which is what I'm > trying to do. Does anyone have any ideas why this would occur? > > Thanks, > Richard -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Channel use/reuse question
Hm, well this defeats the purpose because the point is to not cut into the rather low amount of channels GAE affords us daily. Can anyone from Google confirm that this is the case and the only way to do it is to call create_channel again? Thanks, Richard On May 12, 8:59 am, Westmark wrote: > Hello Richard, > > I had the same problem and could only resolve it by generating a new > token for the reconnecting user, i.e. calling create_channel again. > You can use the same user id though. I believe I read in the docs > somewhere that a token is only good for one sustained connection, > afterwards it's discarded. > > BR // Fredrik > > On May 12, 1:57 pm, Richard Arrano wrote: > > > Hello, > > I've been using the Channel API and for each chat room, I have a fixed > > number of users. So for each room, prior to the launch, I call > > create_channel for each user and store it in a dictionary that I save > > in a TextProperty. When I want to broadcast, I read the TextProperty > > and convert it back to a dictionary, then call channel.send_message on > > each. This works well initially. However, when a user exits the > > session and comes back, it invariably causes this error each time: > > > File "C:\Program Files\Google\google_appengine\google\appengine\api > > \channel\channel_service_stub.py", line 127, in > > _Dynamic_SendChannelMessage > > self._channel_messages[client_id].append(request.message()) > > KeyError: '21024-21026-185804764220139124118' > > > Where the first two numbers are some identifiers and the last part is > > the user id. Does something get "used up" so to speak when the client > > opens the initial connection? I've seen people suggesting reusing > > tokens instead of calling create_channel each time, which is what I'm > > trying to do. Does anyone have any ideas why this would occur? > > > Thanks, > > Richard > > -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Channel use/reuse question
Hi there. You've discovered a bug in the dev_appserver; this case should work fine in production and will be fixed in 1.5.1. If you feel like hacking a patch into the dev_appserver code, you can add this below line 244 of google_appengine/google/appengine/api/ channel/channel_service_stub.py (in the 'else' clause of 'if client_id in self._connected_channels' in connect_channel) 244 self._connected_channels.append(client_id) >>> self._channel_messages[client_id] = [] Hope that helps- -Moishe -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Channel use/reuse question
Hello. Is this local dev server problem only? Have anyone seen this error in prod? Thanks. -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.
[google-appengine] Re: Channel use/reuse question
*Thank you* Moishe. Problem solved - I was going batty, being convinced it was a problem with my code... - Ben On May 17, 9:06 am, Moishe wrote: > Hi there. You've discovered a bug in the dev_appserver; this case > should work fine in production and will be fixed in 1.5.1. > > If you feel like hacking a patch into the dev_appserver code, you can > add this below line 244 of > google_appengine/google/appengine/api/channel/channel_service_stub.py (in the > 'else' clause of 'if client_id > in self._connected_channels' in connect_channel) > > 244 self._connected_channels.append(client_id) > > >>> self._channel_messages[client_id] = [] > > Hope that helps- > > -Moishe -- You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com. To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en.