Reputation: 41
I have a client app that needs to be synchronized tightly with the server. So far, I've been using polls to retrieve the data from my REST Framework views. But the amount of requests is now too large, and I need to move towards a server push option instead. I've looked at a few options, such as Pusher, Redis/PubNub...but there are a lot of options, and very few recent documentation about it.
What would be the best way to implement real time with the django-rest-framework views?
Upvotes: 4
Views: 4814
Reputation: 183
I'm haven't tried it, but I think DRF + Django Channels + Websocket will do the job. I know this is an old thread, so I guess this will help other people having the same problem.
Read: https://blog.heroku.com/in_deep_with_django_channels_the_future_of_real_time_apps_in_django
Upvotes: 5
Reputation: 2415
DRF will not do the job.
I suggest using Pusher or PubNub. Working with them is really easy. Another option is Socket.io.
What these services offer is push notification to your client app. Once notified, your app could request the resurces needed from DRF.
Upvotes: 1
Reputation: 1917
Not familiar with Django as a framework, but I'd highly recommend websockets for real time updates from the server. The typical approach is to use a combination of REST and WS:
State change on Client -> HTTP POST -> Server
Client <- Websocket <- State change on server
Upvotes: 1