Last active
February 26, 2019 12:22
-
-
Save goltsevnet/aec19c62e134c0417fbea8556c1477c0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class BalanceConsumer(AsyncWebsocketConsumer): | |
| async def connect(self): | |
| self.user = self.scope['user'] | |
| if self.user.is_authenticated: | |
| # text_data = json.dumps({ | |
| # 'message': '99999999' | |
| # }) | |
| self.user_name = str(self.user.username) | |
| await self.channel_layer.group_add( | |
| self.user_name, | |
| self.channel_name | |
| ) | |
| print('пробуем выслать') | |
| await asyncio.sleep(5) | |
| await self.channel_layer.group_send( | |
| self.user_name, | |
| self.channel_name, | |
| { | |
| 'type': 'user_name', | |
| 'message': 'test' | |
| } | |
| ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment