def get_channel_token(self):
     if self.json_request:
         channel_id = self.json_request.get('channel_id', None)
     else:
         channel_id = self.request.get('channel_id', None)
     if channel_id:
         self.user_channel_token = ChannelToken.get_by_id(channel_id)
Beispiel #2
0
 def post(self):
     channel_id = self.request.get('from')
     channel_token = ChannelToken.get_by_id(channel_id)
     if not channel_token:
         log.warning('No channel token found to connect')
     else:
         channel_token.connected = True
         channel_token.put()
Beispiel #3
0
    def post(self):
        channel_id = self.request.get('from')
        log.debug('User Disconnected: %s', channel_id)
        channel_token = ChannelToken.get_by_id(channel_id)

        if channel_token:
            log.debug('Found Channel Token')
            channel_token.key.delete()

            channel_tokens = ChannelToken.get_by_project_key(
                channel_token.project, channel_token)
            log.debug('Messaging Other Project Users')
            log.debug(channel_tokens)
            ChannelToken.broadcast_message(channel_tokens, {
                'channel_op': 'remove_user',
                'user': channel_id
            })
        else:
            log.debug('Did Not Find Channel Token')