Doc file for websocket module.
This commit is contained in:
30
doc/modules/websocket.rst
Normal file
30
doc/modules/websocket.rst
Normal file
@@ -0,0 +1,30 @@
|
||||
:mod:`websocket` -- Websocket Server
|
||||
=====================================
|
||||
|
||||
This module provides a simple way to create a `websocket
|
||||
<http://dev.w3.org/html5/websockets/>` server. It works with a few
|
||||
tweaks in the :mod:`~eventlet.wsgi` module that allow websockets to
|
||||
coexist with other WSGI applications.
|
||||
|
||||
To create a websocket server, simply decorate a handler method with
|
||||
:class:`WebSocketWSGI` and use it as a wsgi application::
|
||||
|
||||
from eventlet import wsgi, websocket
|
||||
import eventlet
|
||||
|
||||
@websocket.WebSocketWSGI
|
||||
def hello_world(ws):
|
||||
ws.send("hello world")
|
||||
|
||||
wsgi.server(eventlet.listen(('', 8090)), hello_world)
|
||||
|
||||
|
||||
You can find a slightly more elaborate version of this code in the file
|
||||
``examples/websocket.py``.
|
||||
|
||||
**Note** that the web socket spec is still under development, and it
|
||||
will be necessary to change the way that this module works in response
|
||||
to spec changes.
|
||||
|
||||
.. automodule:: eventlet.websocket
|
||||
:members:
|
||||
Reference in New Issue
Block a user