That's exactly what!
Do you know where this queue is used?
I want to forcibly perform the actual operation.

WebSocket is not tied to one request per request, so I want to be able to 
get 1 request and 2 response.
2024年1月13日土曜日 6:25:31 UTC+9 Ryan Nowakowski:

> This is not surprising after looking at the code a bit. It looks like 
> group_send calls send which puts the message in a queue that gets drained 
> later during worker.handle.
>
>
> https://github.com/django/channels/blob/b6dc8c127d7bda3f5e5ae205332b1388818540c5/channels/layers.py#L217
>
>
> On January 12, 2024 12:19:45 AM CST, Kazuki Nagayama <
> k_nag...@dynaxt.co.jp> wrote:
>
>> 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/35f01d4e-4a2e-4f5b-b39a-18c4dc1994a3n%40googlegroups.com.

Reply via email to