🍾 Easy websockets for bottle.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 9010700 Oct 25, 2016
Failed to load latest commit information.
bottle_websocket v0.2.9 Sep 21, 2015
examples Update examples. Oct 25, 2016
.gitignore Add better chat.py example. Oct 25, 2016
.hgignore Added setup.py and echo server example Sep 26, 2011
LICENSE Update LICENSE. Apr 14, 2014
README.md Misspelled xeross. Apr 16, 2012
requirements.txt Update requirements Apr 10, 2012
setup.py v0.2.9 Sep 21, 2015


This project adds websocket capabilities to bottle, leveraging gevent-websocket and gevent.


Use pip or easy_install:

pip install bottle-websocket


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:
        else: break

And then use the provided server:

run(host='', port=8080, server=GeventWebSocketServer)