django = 5..0.1
channels = 4.0.1

I have code like below.

```python
class ChatConsumer(AsyncWebsocketConsumer):
     async def receive(self, text_data):
             await self.channel_layer.group_send(
                 roomId, {"type": "chat_message", "message": 
"first_chatMessage"}
             )
             import asyncio
             await asyncio.sleep(3)
             await self.channel_layer.group_send(
                 roomId, {"type": "chat_message", "message": 
"second_chatMessage"}
             )
````

This code expects the first_chatMessage to be sent immediately after 
`receive()` is called, and the second_chatMessage to be sent 3 seconds 
later.
But what actually happens is that first_chatMessage and second_chatMessage 
are sent at the same time after 3 seconds.

When `receive()` completes execution, it appears that the content 
accumulated in the buffer is sent to the other party.
Is there a function like `flush()` that forces the buffer to be sent?

thank you.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a37a2132-bca3-44bb-9471-efe6eb8931cdn%40googlegroups.com.

Reply via email to