开发者

How can i make a long polling api with django rest framework

I have a django backend and i'm using django rest framework for my api's, my application is a grading system application that sees change in grades in real time, I don't want to make too many requests to get updates from my server 开发者_高级运维whenever a data is being updated in my server, so i heard of long polling, I've done my research and I've still not gotten any proper guide to implement long polling with django, even in the django channels documentation.

i tried using polling at first and i got the real time updates but it stresses the server with too many requests, till i heard long polling was a better practice.


Django channels is the most effective tool one can use for long pooling but if you don't find that working, then you can change the design of your system and add one instance of using a tool that has persistency capability like java, golang, or you can add pubsub feature in your server so that whenever it gets updated it notifies other services that way your load on the server is not increased and your requirement is also fulfilled.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜