[英]How to implement websocket for push message using django-rest-framework as backend and angular2 as frontend?
websocket
to send push notification to client. 我想实现websocket
将推送通知发送到客户端。 django-rest framework
as backend and angular2
as frontend. 我正在使用django-rest framework
作为后端,而angular2
作为前端。 HTTP
protocol only. 我知道django仅支持HTTP
协议。 And I am unable to get any such links,blogs or resource which helps me to achieve websocket completely. 而且我无法获得任何此类链接,博客或资源来帮助我完全实现websocket。 There are some third party apps which I found and may be useful for implementing push message. 我发现了一些第三方应用程序,这些应用程序可能对实现推送消息有用。 They are... 他们是...
I don't think showing some code is significant here because i have no code relevent to implementation of websocket. 我认为在这里显示一些代码并不重要,因为我对实现websocket没有任何代码依赖性。
So can you people suggest me the best way to implement this thing.Any link,any blog or any code which may help. 因此,您能否向我建议实现此问题的最佳方法。任何链接,任何博客或任何可能有帮助的代码。
One possible solution is to deploy a separate Tornado
app which communicates with Front-end using WebSocket
. 一种可能的解决方案是部署一个单独的Tornado
应用程序,该应用程序使用WebSocket
与Front-end通信。 Then, whenever the Django Back-end wants to send a push notification to the Front-end, it asks the Tornado
app and Tornado
app delivers the push notification to Front-end. 然后,每当Django后端希望将推送通知发送到前端时,它都会询问Tornado
应用,然后Tornado
应用会将推送通知传递到前端。
I have described the process in slightly more detail in this answer of mine. 我已经描述了稍微详细过程这个回答我的。 You might want to have a look. 您可能想看看。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.