14👍
Django itself is build in blocking manner, i.e. with synchronous approach. So, you cannot open persistent websocket with django app, as it will block entire django thread.
If you want to enable notification/chat within django project environment, i would recommend to use centrifuge. It is written in python, but async (non-blocking) framework is used: tornado.
But, you don’t need to even know how it works, as it provides simple REST api to communicate with it.
Simplified workflow, check docs for more details:
- Start
centrifuge
at same server, as your django project (or on another but with low latency between them) - Your front-end will open websocket with centrifuge, not with django project.
- When you need to send notification, send it to centrifuge from django via REST api, and centrifuge will deliver it to needed clients!
I’ve already tried it and it works!
0👍
Django doesn’t provide what you’re looking for out of the box. You’ll have to use a third party library. One that works across frameworks is Pusher.
- U'rest_framework' is not a registered namespace
- How to have Accent-insensitive filter in django with postgres?
- Can you achieve a case insensitive 'unique' constraint in Sqlite3 (with Django)?
- How to make trailing slash optional in django
0👍
I think you must go for Firebase it gives you awesome synchronization and any how you are going to use chat on frontend so its does not have to do anything with django environment so you can update you backend asynchron in callback with firbase. Also firebase with AngularJS provides you really really awesome three way binding.
- Override Django widgets default templates
- How to filter search by values that are not available
- Django python-rq — DatabaseError SSL error: decryption failed or bad record mac
- Api key and Django Rest Framework Auth Token