Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bottle-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-websocket

WebSockets for bottle

  • 0.2.9
  • PyPI
  • Socket score

Maintainers
1

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

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

Keywords

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