DEV Community

Discussion on: How to Add Websockets to a Django App without Extra Dependencies

Collapse
 
mehdimortaz profile image
Parsezan

Thank you for this post. I have a question, how possible send a message to WebSocket from Django views? by above I just can do something just when a client sends me a message.

Collapse
 
lautaronavarro profile image
Lautaro Navarro

That's an excellent question, and I'd like to know the answer, let me know if you find out a way

Collapse
 
htrampe profile image
Holger Trampe • Edited

Did someone found a good solution? The above information is great, but i can do something like that with ajax and json-response. A way from view to the client-websockets is much more interesting. THX!

Collapse
 
lautaronavarro profile image
Lautaro Navarro

I have an implementation for this, maybe you would like to take a look at it!

Basically, the queue can be change by any other type of queue which allows you to exchange data between routines and threads (Each requests to django_application are new threads, you can check that, requests to websocket_application share the same thread)