gevent-websocket

Websocket handler for the gevent pywsgi server, a Python network library
Download

gevent-websocket Ranking & Summary

Advertisement

  • Rating:
  • License:
  • BSD License
  • Publisher Name:
  • Jeffrey Gelens
  • Publisher web site:
  • http://www.gelens.org/

gevent-websocket Tags


gevent-websocket Description

Websocket handler for the gevent pywsgi server, a Python network library gevent-websocket is a websocket library for the Gevent networking library written and maintained by Jeffrey Gelens. It is licensed under the BSD license.InstallationInstall Python 2.4 or newer and gevent and its dependencies. The latest release can be download from here or by cloning the repository.UsageNative GeventAt the moment gevent-websocket has one handler based on the Pywsgi gevent server. Set the handler_class when creating a pywsgi server instance to make use of the Websocket functionality:from gevent import pywsgifrom geventwebsocket.handler import WebSocketHandlerserver = pywsgi.WSGIServer(('127.0.0.1', 8000), websocket_app, handler_class=WebSocketHandler)server.serve_forever()Afterwards write a WSGI application with a 3rd parameter, namely a websocket instance:def websocket_app(environ, start_response, ws): if ws.path == '/echo': message = ws.wait() ws.send(message)GunicornUsing Gunicorn it is even more easy to start a server. Only the websocket_app from the previous example is required to start the server. Dtart Gunicorn using the following command and worker class:gunicorn -k "geventwebsocket.gunicorn.workers.GeventWebSocketWorker" gunicorn_websocket:websocket_app Requirements: · Python


gevent-websocket Related Software