def register(self, msg): """ Request a new endpoint for a channelID """ status = 200 gid = '%s.%s' % (self.uaid, msg['channelID']) response = {"messageType": "register", "status": status, "channelID": msg['channelID'], "pushEndpoint": gen_endpoint(self.config, gid) } return (response, None)
def put(self, args=None, **kw): request = self.request appid = args or gen_id() uaid = request.headers.get('X-UserAgent-ID', gen_id()) gid = '%s.%s' % (uaid, appid) if self.storage.register_appid(uaid, gid, self.logger): self.write(json.dumps({'channelID': appid, 'uaid': uaid, 'pushEndpoint': gen_endpoint(self.config, gid)})) else: self.send_error(409) # CONFLICT