Django的Django WebSocket
django-bagou的Python项目详细描述
Tornado WebSocket服务器,由RabbitMQ上连接的PikaClient支持。
此体系结构的目标是提供一种在 以RabbitMQ作为消息总线的同步应用程序
服务器是Tornado WebSockethandler和PikaClient消费者。
看看简单的演示chat。
安装
git clone https://github.com/socketubs/django-bagou.git cd django-bagou/example virtualenv virtenv source virtenv/source/activate pip install django pip install -e .. python manage.py runserver # In another terminal python manage.py runwebsocket # Go to http://localhost:8000
传入
例如,来自Tornado的传入WebSocket消息被推送到队列中(例如芹菜) 或者只是计算出来的。
- Browser send websocket message
- Tornado received it * Sending AMQP message * Run Celery task (from Django?)
- Torndo reply to websocket
- Browser received websocket message
发送
Django应用程序可以在RabbitMQ上发布消息,Pika和 推到websockets。
- Running arbitary Python code
- Send AMQP message to websocket queue
- PikaClient wich run with Tornado consumed it
- PikaClient tell Tornado to send websocket message to browser
- Browser received websocket message
待办事项
- Channel permission
- User authentification based on sessionid
- Integrated with Celery ?
- Helpers for getting channels