skip to navigation
skip to content

Not Logged In

bottle-tornado-websocket 0.13

WebSockets for bottle

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_tornado_websocket 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:

File Type Py Version Uploaded on Size (md5) Source 2012-04-26 5KB
  • Downloads (All Versions):
  • 62 downloads in the last day
  • 294 downloads in the last week
  • 1015 downloads in the last month