:param dict content: :param kwargs: :return: """ action = self.action_map.get(content['type']) if not action: raise ConsumerException('{} is not a valid action_type'.format(content['type'])) await action(content) content.typeに応じたメソッドを 呼び出すようにreceive_jsonを オーバライド
accept or close if YourCondition: self.accept() else: self.close() async def receive_json(self, content, **kwargs): # receive message print(content) # echo back await self.send_json(content) or ?