You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have made a simple Real-Time Chat Application using Django-channels.
I have made a consumer named ChatConsumer which inherits from AsyncConsumer.
It has methods websocket_connect(), websocket_receive() and websocket_disconnect().
Additionally, I have defined two more methods namely get_thread() and create_chat_message() which interact with the database.
Among these methods, create_chat_message() is the method that actually saves the chat message into the database. It is called from the websocket_receive() method.
The issue I am facing is that, when I use ReconnectingWebSocket, somehow the message received in the websocket_receive() method is saved multiple times in the database.
However, if I use vanilla WebSocket, everything works fine.
I also have also posted about the same issue on StackOverflow which I encountered about a year ago when I was working on a different project. Here is the link to it.
I have been able to reproduce this bug two times in two different projects, so, I am pretty sure that it is somehow related to ReconnectingWebSocket.
The text was updated successfully, but these errors were encountered:
I have observed one more thing about Multiple Entries Being saved.
Number of Times the same value is saved in database == Number of times the WebSocket connection reconnects.
I have made a simple Real-Time Chat Application using Django-channels.
I have made a consumer named ChatConsumer which inherits from AsyncConsumer.
It has methods websocket_connect(), websocket_receive() and websocket_disconnect().
Additionally, I have defined two more methods namely get_thread() and create_chat_message() which interact with the database.
Among these methods, create_chat_message() is the method that actually saves the chat message into the database. It is called from the websocket_receive() method.
The issue I am facing is that, when I use ReconnectingWebSocket, somehow the message received in the websocket_receive() method is saved multiple times in the database.
However, if I use vanilla WebSocket, everything works fine.
I also have also posted about the same issue on StackOverflow which I encountered about a year ago when I was working on a different project. Here is the link to it.
I have been able to reproduce this bug two times in two different projects, so, I am pretty sure that it is somehow related to ReconnectingWebSocket.
The text was updated successfully, but these errors were encountered: