fix readme
This commit is contained in:
@@ -1,12 +1,8 @@
|
|||||||
## WAMP-Klein Application
|
## Flask/WAMP Application using Crochet
|
||||||
|
|
||||||
The examples here demonstrate how to combine a [Klein](https://github.com/twisted/klein) Web application with a Autobahn WAMP application. Klein essentially is Flask for Twisted Web.
|
The examples here demonstrate combining a Flask Web application with Autobahn WAMP code using [Crochet](https://crochet.readthedocs.org/).
|
||||||
|
|
||||||
A detailed discussion of Example 1 (see below) is here:
|
|
||||||
|
|
||||||
* [Mixing Web and WAMP code with Twisted Klein](http://tavendo.com/blog/post/mixing-web-and-wamp-code-with-twisted-klein/)
|
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
* [Example 1](example1): minimalistic; runs Web and WAMP app in different processes
|
* [Example 1](example1)
|
||||||
* [Example 2](example2): more extended; runs Web and WAMP app in same process
|
* [Example 2](example2)
|
||||||
|
|||||||
@@ -1,16 +1,6 @@
|
|||||||
## Flask/WAMP Application using Crochet
|
## Flask/WAMP Application using Crochet
|
||||||
|
|
||||||
This example demonstrates combining a [Klein](https://github.com/twisted/klein) Web application with a Autobahn WAMP application.
|
This example demonstrates combining a Flask Web application with Autobahn WAMP code using [Crochet](https://crochet.readthedocs.org/).
|
||||||
|
|
||||||
> Klein essentially is Flask for Twisted Web.
|
|
||||||
|
|
||||||
### What we do
|
|
||||||
|
|
||||||
1. The app will run a Klein-based Web server.
|
|
||||||
2. Our Web code will receive HTML form data via a plain old HTTP/POST.
|
|
||||||
3. Upon receiving the HTTP/POST, the request handler will perform an asynchronous call to a WAMP procedure before returning
|
|
||||||
4. The WAMP procedure called is running as a WAMP component connected to a WAMP router
|
|
||||||
5. The Web app is also connected to the same router, so it can call the procedure
|
|
||||||
|
|
||||||
### Running the Example
|
### Running the Example
|
||||||
|
|
||||||
@@ -31,4 +21,4 @@ Now open the WAMP Web client `client.html` in your browser, and then visit [http
|
|||||||
|
|
||||||
You should see the Web client be notified in real-time of the new page visit count:
|
You should see the Web client be notified in real-time of the new page visit count:
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -1,38 +1,22 @@
|
|||||||
## WAMP-Klein Application
|
## Flask/WAMP Application using Crochet
|
||||||
|
|
||||||
This example demonstrates combining a [Klein](https://github.com/twisted/klein) Web application with a Autobahn WAMP application.
|
This example demonstrates combining a Flask Web application with Autobahn WAMP code using [Crochet](https://crochet.readthedocs.org/).
|
||||||
|
|
||||||
> Klein essentially is Flask for Twisted Web.
|
|
||||||
|
|
||||||
### What we do
|
|
||||||
|
|
||||||
1. The app will run a Klein-based Web server.
|
|
||||||
2. Our Web code will receive HTML form data via a plain old HTTP/POST.
|
|
||||||
3. Upon receiving the HTTP/POST, the request handler will perform an asynchronous call to a WAMP procedure before returning
|
|
||||||
4. The WAMP procedure called is running as a WAMP component connected to a WAMP router
|
|
||||||
5. The Web app is also connected to the same router, so it can call the procedure
|
|
||||||
|
|
||||||
### Running the Example
|
### Running the Example
|
||||||
|
|
||||||
Install dependencies:
|
Install dependencies:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
pip install autobahn[twisted] klein
|
pip install flask autobahn[twisted] crochet
|
||||||
```
|
```
|
||||||
|
|
||||||
Start our WAMP application component (together with a development WAMP router):
|
Start the server:
|
||||||
|
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
python server_wamp.py
|
python server.py
|
||||||
```
|
```
|
||||||
|
|
||||||
You can test the WAMP application component from your browser by opening `test_wamp.html`.
|
Now open the WAMP Web client `test_web.html` in your browser to test the (indirect) Web path to `square` and `slowsquare`, and `test_wamp.html` to test the (direct) WAMP path to those functions.
|
||||||
|
|
||||||
Now, start our Klein-based Web server (which will connect to above WAMP router):
|

|
||||||
|
|
||||||
```shell
|
|
||||||
python server_web.py
|
|
||||||
```
|
|
||||||
|
|
||||||
Open `test_web.html` in your browser.
|
|
||||||
|
|||||||
Reference in New Issue
Block a user