New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

bottle-tornado-websocket

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bottle-tornado-websocket

WebSockets for bottle

  • 0.13
  • PyPI
  • Socket score

Maintainers
1

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):
        self.write(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 chat.py in examples/echo folder:

python echo.py

To run chat example just run chat.py in examples/chat folder:

python chat.py

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc