bottle-websocket-0.2.9
توضیحات
WebSockets for bottle
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | bottle-websocket-0.2.9 |
| نام | bottle-websocket |
| نسخه کتابخانه | 0.2.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Zach Kelling |
| ایمیل نویسنده | zk@monoid.io |
| آدرس صفحه اصلی | https://github.com/zeekay/bottle-websocket |
| آدرس اینترنتی | https://pypi.org/project/bottle-websocket/ |
| مجوز | MIT |
This project adds websocket capabilities to [bottle](http://bottlepy.org), leveraging [gevent-websocket](http://www.gelens.org/code/gevent-websocket/) and [gevent](http://www.gevent.org/).
### Install
Use `pip` or `easy_install`:
pip install bottle-websocket
### Usage
Usage is pretty straight-forward, just import the server and plugin:
from bottle.ext.websocket import GeventWebSocketServer
from bottle.ext.websocket import websocket
You can use the websocket plugin to turn routes websocket handlers, the websocket is passed to the route as the first argument:
@get('/websocket', apply=[websocket])
def echo(ws):
while True:
msg = ws.receive()
if msg is not None:
ws.send(msg)
else: break
And then use the provided server:
run(host='127.0.0.1', port=8080, server=GeventWebSocketServer)
### Contributors
- [zeekay](https://github.com/zeekay)
- [xeross](https://github.com/xeross)
نحوه نصب
نصب پکیج whl bottle-websocket-0.2.9:
pip install bottle-websocket-0.2.9.whl
نصب پکیج tar.gz bottle-websocket-0.2.9:
pip install bottle-websocket-0.2.9.tar.gz