def add(self, data): try: json_obj = json.loads(data) token = Token() if token.get_data(json_obj['token'], json_obj['data']['channel']): self.logger.debug('django-sockjs-server:Subscrbe to channel %s' % json_obj['data']['channel']) self.conn.subscribe_list.add(json_obj['data']['channel']) self.conn.pika_client.add_subscriber_channel(json_obj['data']['channel'], self.conn) except (KeyError, TypeError): pass
def add(self, data): try: json_obj = json.loads(data) token = Token() self._compat_transform(json_obj) if token.get_data(json_obj['token'], json_obj['data']['room']): #uid = self._generate_id(json_obj) host = self.get_host() room = json_obj['data']['room'] uid = self.conn.id self.conn.sockjs_server.add_subscriber_room(room, self.conn) self.logger.debug( 'django-sockjs-server (Subscribe): Subscribe to channel %s' % room) self.redis.lpush(room, json.dumps({'host': host, 'id': uid})) except (KeyError, TypeError): pass
def add(self, data): try: json_obj = json.loads(data) token = Token() self._compat_transform(json_obj) if token.get_data(json_obj['token'], json_obj['data']['room']): #uid = self._generate_id(json_obj) host = self.get_host() room = json_obj['data']['room'] uid = self.conn.id self.conn.sockjs_server.add_subscriber_room( room, self.conn ) self.logger.debug( 'django-sockjs-server (Subscribe): Subscribe to channel %s' % room ) self.redis.lpush( room, json.dumps({'host': host, 'id': uid}) ) except (KeyError, TypeError): pass
def add(self, data): try: json_obj = json.loads(data) token = Token() if token.get_data(json_obj['token'], json_obj['data']['channel']): uid = self._generate_id(json_obj) host = self.get_host() room = json_obj['data']['channel'] self.logger.debug( 'django-sockjs-server:Subscrbe to channel %s' % json_obj['data']['channel']) self.redis.lpush(json_obj['data']['channel'], json.dumps({ 'host': host, 'id': uid })) self.conn.subscribe_list.add(uid) self.conn.pika_client.add_subscriber_channel( uid, room, self.conn) except (KeyError, TypeError): pass