From c1b51b2bda8c6b8a4b726ca482cf705b4507eda9 Mon Sep 17 00:00:00 2001 From: Tobias Oberstein Date: Wed, 30 Jul 2014 20:31:04 +0200 Subject: [PATCH] work on docs --- doc/websocket/examples.rst | 90 ++++++++++++++++--- .../asyncio/websocket/slowsquare/README.md | 1 + examples/asyncio/websocket/testee/README.md | 3 + 3 files changed, 83 insertions(+), 11 deletions(-) create mode 100644 examples/asyncio/websocket/testee/README.md diff --git a/doc/websocket/examples.rst b/doc/websocket/examples.rst index e8a00c6c..b8a262e6 100644 --- a/doc/websocket/examples.rst +++ b/doc/websocket/examples.rst @@ -4,29 +4,97 @@ WebSocket Examples ================== Basic Examples -++++++++++++++ +-------------- -* WebSocket Echo: `Twisted `__ - `asyncio `__ -* Slow Square: `Twisted `__ - `asyncio `__ -* Testee: `Twisted `__ - `asyncio `__ +.. note:: + The examples here demonstrate WebSocket programming with |ab| and are available in Twisted and asyncio-based variants respectively. + +Echo +.... + +`Twisted `__ / `asyncio `__ + +A simple WebSocket echo server and client. + +Slow Square +............ + +`Twisted `__ / `asyncio `__ + +This example shows a WebSocket server that will receive a JSON encode float over WebSocket, slowly compute the square, and send back the result. +The example is intended to demonstrate how to use co-routines inside WebSocket handlers. -Additional Examples (Twisted only) -++++++++++++++++++++++++++++++++++ +Testee +...... +`Twisted `__ / `asyncio `__ + +The example implements a *testee* for testing against `Autobahn|Testsuite `_. + +----------- + + +Additional Examples +------------------- + +.. note:: + The examples here demonstrate various further features and aspects of WebSocket programming with |ab|. However, these examples are **currently only available for Twisted**. + + +Secure WebSocket +................ + +`Twisted `__ + +How to run WebSocket over TLS ("wss"). + + +WebSocket and Twisted Web +......................... + +`Twisted `__ + +How to run WebSocket under Twisted Web. This is a very powerful feature, as it allows you to create a complete HTTP(S) resource hierarchy with different services like static file serving, REST and WebSocket combined under one server. + + +Twisted Web, WebSocket and WSGI +............................... + +`Twisted `__ + +This example shows how to run Flask (or any other WSGI compliant Web thing) under Twisted Web and combine that with WebSocket. + + +Secure WebSocket and Twisted Web +................................ + +`Twisted `__ + +A variant of the previous example that runs a HTTPS server with secure WebSocket on a subpath. + + +WebSocket Ping-Pong +................... + +`Twisted `__ + +The example demonstrates how to trigger and process WebSocket pings and pongs. + + +More +.... + +* `WebSocket Authentication with Mozilla Persona `_ * `Broadcasting over WebSocket `_ * `WebSocket Compression `_ * `WebSocket over Twisted Endpoints `_ * `Using HTTP Headers with WebSocket `_ * `WebSocket on Multicore `_ * `WebSocket as a Twisted Service `_ -* `Running WebSocket under Twisted Web `_ -* `Running secure WebSocket under Twisted Web `_ -* `WebSocket Echo over secure WebSocket `_ * `WebSocket Echo Variants `_ * `WebSocket Fallbacks `_ -* `WebSocket and WSGI/Flask `_ * `Using multiple WebSocket Protocols `_ -* `WebSocket Pings/Pongs `_ * `Streaming WebSocket `_ * `Wrapping Twisted Protocol/Factories over WebSocket `_ +* `Using wxPython with Autobahn `_ diff --git a/examples/asyncio/websocket/slowsquare/README.md b/examples/asyncio/websocket/slowsquare/README.md index adfb2464..b11f8cde 100644 --- a/examples/asyncio/websocket/slowsquare/README.md +++ b/examples/asyncio/websocket/slowsquare/README.md @@ -6,6 +6,7 @@ This example is intended to demonstrate how to use coroutines inside WebSocket h > This example uses the Asyncio integration of **Autobahn**|Python. You can find the corresponding example using the Twisted integration [here](https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/slowsquare). > + ## Running Run the server (Python 3) diff --git a/examples/asyncio/websocket/testee/README.md b/examples/asyncio/websocket/testee/README.md new file mode 100644 index 00000000..d6d32242 --- /dev/null +++ b/examples/asyncio/websocket/testee/README.md @@ -0,0 +1,3 @@ +# Autobahn Testsuite Testee + +This is an asyncio-based testee for testing against [Autobahn|Testsuite](http://autobahn.ws/testsuite). \ No newline at end of file