Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

WebSockets for bottle

Project Description

Bottle Tornado Websocket

This project adds websocket capabilities to [bottle](, leveraging [tornado](

### Install
Use `pip` or `easy_install`:

pip install bottle-tornado-websocket

### Requirements

* Bottle
* Tornado

### Usage
Import the server and tornado's WebSocketHandler:

from bottle.ext.tornadosocket import TornadoWebSocketServer
from tornado.websocket import WebSocketHandler

Create your application handlers, for example:

class EchoWebSocket(tornado.websocket.WebSocketHandler):
def open(self):
print 'Connected')

def on_message(self, message):

def on_close(self):
print 'Connection closed')

Map handlers to urls:

tornado_handlers = [
(r"/echo", EchoWebSocket)

Note: the `.*` is automatically mapped as a last handler to your normal bottle application

And then use the provided server:

run(port=8080, server=TornadoWebSocketServer, handlers=tornado_handlers)

### Example
To echo chat example just run `` in `examples/echo` folder:


To run chat example just run `` in `examples/chat` folder:


Release History

This version
History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(5.3 kB) Copy SHA256 Hash SHA256
Source None Apr 26, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Kabu Creative Kabu Creative UX & Design Google Google Cloud Servers Fastly Fastly CDN StatusPage StatusPage Statuspage DigiCert DigiCert EV Certificate