开发者

How to serve several Web Socket

I have 30 smart-sensors distributed in several private networks with Internet access (all of them). I have to establish a persistent connection (socket) between those sensors and a server which has a public IP.

A user can access each sensor thro开发者_运维百科ugh a website (Django) and send or get data.

From your point of view, how can I ensure several persistent and private connections? I found https://github.com/gregmuellegger/django-websocket, but I think is not suitable for my application because I cannot recover an existent socket connection from other Django views.

Any suggestions are very well received.

I found a good approach using Twisted Perspective Broker with JSON-RPC in the server providing methods to support each smart sensor, and for the other side each sensor will use a JSON library to authenticate (basic) and send data.

What do you think? Is this a good solution? I will post results as soon as I test it.


Set up a seperate server that keeps the persistent connections, and allow the django application to query it. Twisted can provide a great framework for writing simple, single purpouse servers, and there is a good tutorial on how to write an XML-RPC server here. Python has excellent support for XML-RPC, and it should be easy enough to get it up and running.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜