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)
Raw data
{
"_id": null,
"home_page": "https://github.com/zeekay/bottle-websocket",
"name": "bottle-websocket",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "bottle websockets",
"author": "Zach Kelling",
"author_email": "zk@monoid.io",
"download_url": "https://files.pythonhosted.org/packages/17/8e/a22666b4bb0a6e31de579504077df2b1c2f1438136777c728e6cfabef295/bottle-websocket-0.2.9.tar.gz",
"platform": "UNKNOWN",
"description": "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/).\n\n### Install\nUse `pip` or `easy_install`:\n\n pip install bottle-websocket\n\n### Usage\nUsage is pretty straight-forward, just import the server and plugin:\n\n from bottle.ext.websocket import GeventWebSocketServer\n from bottle.ext.websocket import websocket\n\nYou can use the websocket plugin to turn routes websocket handlers, the websocket is passed to the route as the first argument:\n\n @get('/websocket', apply=[websocket])\n def echo(ws):\n while True:\n msg = ws.receive()\n if msg is not None:\n ws.send(msg)\n else: break\n\nAnd then use the provided server:\n\n run(host='127.0.0.1', port=8080, server=GeventWebSocketServer)\n\n### Contributors\n- [zeekay](https://github.com/zeekay)\n- [xeross](https://github.com/xeross)",
"bugtrack_url": null,
"license": "MIT",
"summary": "WebSockets for bottle",
"version": "0.2.9",
"project_urls": {
"Download": "UNKNOWN",
"Homepage": "https://github.com/zeekay/bottle-websocket"
},
"split_keywords": [
"bottle",
"websockets"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "178ea22666b4bb0a6e31de579504077df2b1c2f1438136777c728e6cfabef295",
"md5": "a66a85716b407535243b234b9b7fd67f",
"sha256": "9887f70dc0c7592ed8d0d11a14aa95dede6cd08d50d83d5b81fd963e5fec738b"
},
"downloads": -1,
"filename": "bottle-websocket-0.2.9.tar.gz",
"has_sig": false,
"md5_digest": "a66a85716b407535243b234b9b7fd67f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2007,
"upload_time": "2015-09-21T05:34:24",
"upload_time_iso_8601": "2015-09-21T05:34:24.871273Z",
"url": "https://files.pythonhosted.org/packages/17/8e/a22666b4bb0a6e31de579504077df2b1c2f1438136777c728e6cfabef295/bottle-websocket-0.2.9.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2015-09-21 05:34:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "zeekay",
"github_project": "bottle-websocket",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "bottle-websocket"
}