如何在 Django 中构建推送系统? [英] How to build a push system in django?

查看:8
本文介绍了如何在 Django 中构建推送系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在django中搭建一个推送系统,基本上它的功能是将消息从服​​务器推送到浏览器.

I need to build a push system in django, basicly its function is to push messages from server to browser.

由于无法使用 nodejs,我更喜欢 websocket 或轨道,但我不知道如何在 django 中实现这两个中的任何一个.请为我推荐一种方法,这对我有很大帮助,谢谢.

As nodejs cannot be used, i prefer websocket or orbited, but i've no idea how to implement any of these two in django. pls recommend a method for me, this will help me a lot, thx.

推荐答案

Django 不擅长将事情推送"给客户端.如果 django 是您唯一的选择,那么模拟推送的唯一方法是通过长轮询.但这效率不高.相反,websockets 很热.龙卷风和扭曲可以在这里帮助你.您的问题还有更完整的答案此处.

Django isn't good at "pushing" things to the client. If django is your only option, the only way to mimic a push is via long-polling. But this is not efficient. Instead, websockets are hot. Tornado and twisted can help you here. There is also a more complete answer to your question here.

这篇关于如何在 Django 中构建推送系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆