0.2.9 - This version may not be safe as it has not been updated for a long time. Find out if your coding project uses this component and get notified of any reported security vulnerabilities with Meterian-X Open Source Security Platform
Maintain your licence declarations and avoid unwanted licences to protect your IP the way you intended.
MIT - MIT LicenseThis 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 websocketYou 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: breakAnd then use the provided server:
run(host='127.0.0.1', port=8080, server=GeventWebSocketServer)