Add pubsub server API, without client API or UI yet.

This commit is contained in:
Ian Gulliver
2014-05-06 22:46:07 -07:00
parent bb5c0752b1
commit e6885042f5
4 changed files with 135 additions and 32 deletions

View File

@@ -29,14 +29,18 @@ class OnChannelConnect(webapp2.RequestHandler):
client.channel_active = True
client.put()
class OnChannelDisconnect(webapp2.RequestHandler):
@utils.local_namespace
@db.transactional()
def post(self):
client = models.Client.get(self.request.get('from'))
client.channel_active = False
client.put()
subscriptions = models.Subscription.all().filter('client =', client)
for subscription in subscriptions:
subscription.delete()
app = webapp2.WSGIApplication([
('/_ah/channel/connected/', OnChannelConnect),