Send message using Django Channels from outside Consumer class
Firstly you need your consumer instance to subscribe to a group. from asgiref.sync import async_to_sync class GameConsumer(WebsocketConsumer): def connect(self): self.accept() self.render() async_to_sync(self.add_group)(‘render_updates_group’) controller.startTurn() … Then if you are outside of your consumer you will need to send a message to that group so that all the consumers that have registered onto the group get the … Read more