some fixes to project URLs
This commit is contained in:
@@ -74,11 +74,11 @@ The **Private non-API** isn't an API at all: like class members which may only b
|
|||||||
|
|
||||||
The new rule for the public API is simple: if something is exported from the modules below, then it is public. Otherwise not.
|
The new rule for the public API is simple: if something is exported from the modules below, then it is public. Otherwise not.
|
||||||
|
|
||||||
* [Top](https://github.com/tavendo/AutobahnPython/blob/master/autobahn/__init__.py)
|
* [Top](https://github.com/crossbario/autobahn-python/blob/master/autobahn/__init__.py)
|
||||||
* [WebSocket](https://github.com/tavendo/AutobahnPython/blob/master/autobahn/websocket/__init__.py)
|
* [WebSocket](https://github.com/crossbario/autobahn-python/blob/master/autobahn/websocket/__init__.py)
|
||||||
* [WAMP](https://github.com/tavendo/AutobahnPython/blob/master/autobahn/wamp/__init__.py)
|
* [WAMP](https://github.com/crossbario/autobahn-python/blob/master/autobahn/wamp/__init__.py)
|
||||||
* [Asyncio](https://github.com/tavendo/AutobahnPython/blob/master/autobahn/asyncio/__init__.py)
|
* [Asyncio](https://github.com/crossbario/autobahn-python/blob/master/autobahn/asyncio/__init__.py)
|
||||||
* [Twisted](https://github.com/tavendo/AutobahnPython/blob/master/autobahn/twisted/__init__.py)
|
* [Twisted](https://github.com/crossbario/autobahn-python/blob/master/autobahn/twisted/__init__.py)
|
||||||
|
|
||||||
### Cross-platform Considerations
|
### Cross-platform Considerations
|
||||||
|
|
||||||
@@ -121,7 +121,7 @@ Either the success or error callback can be ``None`` (e.g. if you just need to a
|
|||||||
|
|
||||||
### Use of assert vs Exceptions
|
### Use of assert vs Exceptions
|
||||||
|
|
||||||
> See the discussion [here](https://github.com/tavendo/AutobahnPython/issues/99).
|
> See the discussion [here](https://github.com/crossbario/autobahn-python/issues/99).
|
||||||
|
|
||||||
`assert` is for telling fellow programmers: "When I wrote this, I thought X could/would never really happen, and if it does, this code will very likely do the wrong thing".
|
`assert` is for telling fellow programmers: "When I wrote this, I thought X could/would never really happen, and if it does, this code will very likely do the wrong thing".
|
||||||
|
|
||||||
@@ -320,7 +320,7 @@ After the upload has finished, check the live pages:
|
|||||||
|
|
||||||
### 0.10.6
|
### 0.10.6
|
||||||
|
|
||||||
[Milestone for 0.10.6](https://github.com/tavendo/AutobahnPython/milestones/0.10.6)
|
[Milestone for 0.10.6](https://github.com/crossbario/autobahn-python/milestones/0.10.6)
|
||||||
|
|
||||||
* Automatic reconnection
|
* Automatic reconnection
|
||||||
* Configurable WAMP connecting transports
|
* Configurable WAMP connecting transports
|
||||||
@@ -331,6 +331,6 @@ After the upload has finished, check the live pages:
|
|||||||
|
|
||||||
### 0.11.0
|
### 0.11.0
|
||||||
|
|
||||||
[Milestone for 0.11.0](https://github.com/tavendo/AutobahnPython/milestones/0.11.0)
|
[Milestone for 0.11.0](https://github.com/crossbario/autobahn-python/milestones/0.11.0)
|
||||||
|
|
||||||
* new main development line with new, long-term API
|
* new main development line with new, long-term API
|
||||||
|
|||||||
10
README.rst
10
README.rst
@@ -7,9 +7,9 @@ WebSocket & WAMP for Python on Twisted and asyncio.
|
|||||||
|
|
||||||
--------------
|
--------------
|
||||||
|
|
||||||
| **Quick Links**: `Source Code <https://github.com/tavendo/AutobahnPython>`__ - `Documentation <http://autobahn.ws/python>`__ - `WebSocket Examples <http://autobahn.ws/python/websocket/examples.html>`__ - `WAMP Examples <http://autobahn.ws/python/wamp/examples.html>`__
|
| **Quick Links**: `Source Code <https://github.com/crossbario/autobahn-python>`__ - `Documentation <http://autobahn.ws/python>`__ - `WebSocket Examples <http://autobahn.ws/python/websocket/examples.html>`__ - `WAMP Examples <http://autobahn.ws/python/wamp/examples.html>`__
|
||||||
| **Community**: `Mailing list <http://groups.google.com/group/autobahnws>`__ - `StackOverflow <http://stackoverflow.com/questions/tagged/autobahn>`__ - `Twitter <https://twitter.com/autobahnws>`__ - `IRC #autobahn/chat.freenode.net <https://webchat.freenode.net/>`__
|
| **Community**: `Mailing list <http://groups.google.com/group/autobahnws>`__ - `StackOverflow <http://stackoverflow.com/questions/tagged/autobahn>`__ - `Twitter <https://twitter.com/autobahnws>`__ - `IRC #autobahn/chat.freenode.net <https://webchat.freenode.net/>`__
|
||||||
| **Companion Projects**: `Autobahn|JS <https://github.com/tavendo/AutobahnJS/>`__ - `Autobahn|Cpp <https://github.com/tavendo/AutobahnCpp>`__ - `Autobahn|Testsuite <https://github.com/tavendo/AutobahnTestSuite>`__ - `Crossbar.io <http://crossbar.io>`__ - `WAMP <http://wamp.ws>`__
|
| **Companion Projects**: `Autobahn|JS <https://github.com/crossbario/autobahn-js/>`__ - `Autobahn|Cpp <https://github.com/crossbario/autobahn-cpp>`__ - `Autobahn|Testsuite <https://github.com/crossbario/autobahn-testsuite>`__ - `Crossbar.io <http://crossbar.io>`__ - `WAMP <http://wamp.ws>`__
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
@@ -42,12 +42,12 @@ Features
|
|||||||
- best-in-class standards conformance (100% strict passes with `Autobahn Testsuite <http://autobahn.ws/testsuite>`__: `Server Test Report <http://autobahn.ws/python/testreport/servers/index.html>`__ / `Client Test Report <http://autobahn.ws/python/testreport/clients/index.html>`__)
|
- best-in-class standards conformance (100% strict passes with `Autobahn Testsuite <http://autobahn.ws/testsuite>`__: `Server Test Report <http://autobahn.ws/python/testreport/servers/index.html>`__ / `Client Test Report <http://autobahn.ws/python/testreport/clients/index.html>`__)
|
||||||
- message-, frame- and streaming-APIs for WebSocket
|
- message-, frame- and streaming-APIs for WebSocket
|
||||||
- supports TLS (secure WebSocket) and proxies
|
- supports TLS (secure WebSocket) and proxies
|
||||||
- Open-source (`MIT license <https://github.com/tavendo/AutobahnPython/blob/master/LICENSE>`__)
|
- Open-source (`MIT license <https://github.com/crossbario/autobahn-python/blob/master/LICENSE>`__)
|
||||||
|
|
||||||
Show me some code
|
Show me some code
|
||||||
-----------------
|
-----------------
|
||||||
|
|
||||||
To give you a first impression, here are two examples. We have lot more `in the repo <https://github.com/tavendo/AutobahnPython/tree/master/examples>`__.
|
To give you a first impression, here are two examples. We have lot more `in the repo <https://github.com/crossbario/autobahn-python/tree/master/examples>`__.
|
||||||
|
|
||||||
WebSocket Echo Server
|
WebSocket Echo Server
|
||||||
~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~
|
||||||
@@ -132,7 +132,7 @@ Above code will work on Twisted and asyncio by changing a single line
|
|||||||
:target: https://pypi.python.org/pypi/autobahn
|
:target: https://pypi.python.org/pypi/autobahn
|
||||||
|
|
||||||
.. |GitHub Stars| image:: https://img.shields.io/github/stars/tavendo/AutobahnPython.svg?style=social&label=Star
|
.. |GitHub Stars| image:: https://img.shields.io/github/stars/tavendo/AutobahnPython.svg?style=social&label=Star
|
||||||
:target: https://github.com/tavendo/AutobahnPython
|
:target: https://github.com/crossbario/autobahn-python
|
||||||
|
|
||||||
.. |Master Branch| image:: https://img.shields.io/badge/branch-master-orange.svg
|
.. |Master Branch| image:: https://img.shields.io/badge/branch-master-orange.svg
|
||||||
:target: https://travis-ci.org/tavendo/AutobahnPython.svg?branch=master
|
:target: https://travis-ci.org/tavendo/AutobahnPython.svg?branch=master
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ class WSGIRootResource(Resource):
|
|||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
* `Autobahn Twisted Web WSGI example <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_wsgi>`_
|
* `Autobahn Twisted Web WSGI example <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_wsgi>`_
|
||||||
* `Original hack <http://blog.vrplumber.com/index.php?/archives/2426-Making-your-Twisted-resources-a-url-sub-tree-of-your-WSGI-resource....html>`_
|
* `Original hack <http://blog.vrplumber.com/index.php?/archives/2426-Making-your-Twisted-resources-a-url-sub-tree-of-your-WSGI-resource....html>`_
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class IdGenerator(object):
|
|||||||
Hence, IDs can be safely used with languages that use IEEE double as their
|
Hence, IDs can be safely used with languages that use IEEE double as their
|
||||||
main (or only) number type (JavaScript, Lua, etc).
|
main (or only) number type (JavaScript, Lua, etc).
|
||||||
|
|
||||||
See https://github.com/tavendo/WAMP/blob/master/spec/basic.md#ids
|
See https://github.com/wamp-proto/wamp-proto/blob/master/spec/basic.md#ids
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -147,7 +147,7 @@ class IdGenerator(object):
|
|||||||
#
|
#
|
||||||
# Note on the ID range [0, 2**53]. We once reduced the range to [0, 2**31].
|
# Note on the ID range [0, 2**53]. We once reduced the range to [0, 2**31].
|
||||||
# This lead to extremely hard to track down issues due to ID collisions!
|
# This lead to extremely hard to track down issues due to ID collisions!
|
||||||
# Here: https://github.com/tavendo/AutobahnPython/issues/419#issue-90483337
|
# Here: https://github.com/crossbario/autobahn-python/issues/419#issue-90483337
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
4
doc/_templates/layout.html
vendored
4
doc/_templates/layout.html
vendored
@@ -43,9 +43,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="side_toc sidebar_block" id="quicklinks">
|
<div class="side_toc sidebar_block" id="quicklinks">
|
||||||
<h4><a href="https://pypi.python.org/pypi/autobahn/">Download</a></h4>
|
<h4><a href="https://pypi.python.org/pypi/autobahn/">Download</a></h4>
|
||||||
<h4><a href="https://github.com/tavendo/AutobahnPython">Source Code</a></h4>
|
<h4><a href="https://github.com/crossbario/autobahn-python">Source Code</a></h4>
|
||||||
<h4><a href="https://groups.google.com/forum/#!forum/autobahnws">Mailing List</a></h4>
|
<h4><a href="https://groups.google.com/forum/#!forum/autobahnws">Mailing List</a></h4>
|
||||||
<h4><a href="https://github.com/tavendo/AutobahnPython/issues">Issue Tracker</a></h4>
|
<h4><a href="https://github.com/crossbario/autobahn-python/issues">Issue Tracker</a></h4>
|
||||||
<h4><a href="http://stackoverflow.com/questions/tagged/autobahn?sort=newest">StackOverflow</a></h4>
|
<h4><a href="http://stackoverflow.com/questions/tagged/autobahn?sort=newest">StackOverflow</a></h4>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
4
doc/_templates/side-primary.html
vendored
4
doc/_templates/side-primary.html
vendored
@@ -15,9 +15,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="side_toc sidebar_block" id="quicklinks">
|
<div class="side_toc sidebar_block" id="quicklinks">
|
||||||
<h4><a href="https://pypi.python.org/pypi/autobahn/">Download</a></h4>
|
<h4><a href="https://pypi.python.org/pypi/autobahn/">Download</a></h4>
|
||||||
<h4><a href="https://github.com/tavendo/AutobahnPython">Source Code</a></h4>
|
<h4><a href="https://github.com/crossbario/autobahn-python">Source Code</a></h4>
|
||||||
<h4><a href="https://groups.google.com/forum/#!forum/autobahnws">Mailing List</a></h4>
|
<h4><a href="https://groups.google.com/forum/#!forum/autobahnws">Mailing List</a></h4>
|
||||||
<h4><a href="https://github.com/tavendo/AutobahnPython/issues">Issue Tracker</a></h4>
|
<h4><a href="https://github.com/crossbario/autobahn-python/issues">Issue Tracker</a></h4>
|
||||||
<h4><a href="http://stackoverflow.com/questions/tagged/autobahn?sort=newest">StackOverflow</a></h4>
|
<h4><a href="http://stackoverflow.com/questions/tagged/autobahn?sort=newest">StackOverflow</a></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -260,7 +260,7 @@ rst_epilog = """
|
|||||||
.. _Jython: http://jython.org/
|
.. _Jython: http://jython.org/
|
||||||
.. _WAMP: http://wamp.ws/
|
.. _WAMP: http://wamp.ws/
|
||||||
.. _WAMPv1: http://wamp.ws/spec/wamp1/
|
.. _WAMPv1: http://wamp.ws/spec/wamp1/
|
||||||
.. _WAMPv2: https://github.com/tavendo/WAMP/blob/master/spec/README.md
|
.. _WAMPv2: https://github.com/wamp-proto/wamp-proto/blob/master/spec/README.md
|
||||||
.. _AutobahnTestsuite: http://autobahn.ws/testsuite
|
.. _AutobahnTestsuite: http://autobahn.ws/testsuite
|
||||||
.. _trollius: https://pypi.python.org/pypi/trollius/
|
.. _trollius: https://pypi.python.org/pypi/trollius/
|
||||||
.. _tulip: https://pypi.python.org/pypi/asyncio/
|
.. _tulip: https://pypi.python.org/pypi/asyncio/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
Contribute
|
Contribute
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|ab| is an open source project, and hosted on GitHub. The `GitHub repository <https://github.com/tavendo/AutobahnPython>`_ includes the documentation.
|
|ab| is an open source project, and hosted on GitHub. The `GitHub repository <https://github.com/crossbario/autobahn-python>`_ includes the documentation.
|
||||||
|
|
||||||
We're looking for all kinds of contributions - from simple fixes of typos in the code or documentation to implementation of new features and additions of tutorials.
|
We're looking for all kinds of contributions - from simple fixes of typos in the code or documentation to implementation of new features and additions of tutorials.
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ WebSocket allows `bidirectional real-time messaging <http://tavendo.com/blog/pos
|
|||||||
* implements `WebSocket compression <http://tools.ietf.org/html/draft-ietf-hybi-permessage-compression>`_
|
* implements `WebSocket compression <http://tools.ietf.org/html/draft-ietf-hybi-permessage-compression>`_
|
||||||
* implements `WAMP`_, the Web Application Messaging Protocol
|
* implements `WAMP`_, the Web Application Messaging Protocol
|
||||||
* supports TLS (secure WebSocket) and proxies
|
* supports TLS (secure WebSocket) and proxies
|
||||||
* Open-source (`MIT license <https://github.com/tavendo/AutobahnPython/blob/master/LICENSE>`_)
|
* Open-source (`MIT license <https://github.com/crossbario/autobahn-python/blob/master/LICENSE>`_)
|
||||||
|
|
||||||
...and much more.
|
...and much more.
|
||||||
|
|
||||||
@@ -140,8 +140,8 @@ A sample **WebSocket server**:
|
|||||||
|
|
||||||
Complete example code:
|
Complete example code:
|
||||||
|
|
||||||
* `WebSocket Echo (Twisted-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo>`_
|
* `WebSocket Echo (Twisted-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo>`_
|
||||||
* `WebSocket Echo (Asyncio-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo>`_
|
* `WebSocket Echo (Asyncio-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/echo>`_
|
||||||
|
|
||||||
Introduction to WebSocket Programming with |ab|:
|
Introduction to WebSocket Programming with |ab|:
|
||||||
|
|
||||||
@@ -180,8 +180,8 @@ A sample **WAMP application component** implementing all client roles:
|
|||||||
|
|
||||||
Complete example code:
|
Complete example code:
|
||||||
|
|
||||||
* `Twisted Example <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/wamp/overview/>`__
|
* `Twisted Example <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/overview/>`__
|
||||||
* `asyncio Example <https://github.com/tavendo/AutobahnPython/blob/master/examples/asyncio/wamp/overview/>`__
|
* `asyncio Example <https://github.com/crossbario/autobahn-python/blob/master/examples/asyncio/wamp/overview/>`__
|
||||||
|
|
||||||
Introduction to WAMP Programming with |ab|:
|
Introduction to WAMP Programming with |ab|:
|
||||||
|
|
||||||
@@ -209,12 +209,12 @@ For **WAMP developers**, :doc:`wamp/programming` gives an introduction for progr
|
|||||||
Community
|
Community
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Development of |ab| takes place on the GitHub `source repository <https://github.com/tavendo/AutobahnPython>`_.
|
Development of |ab| takes place on the GitHub `source repository <https://github.com/crossbario/autobahn-python>`_.
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
We are open for contributions, whether that's code or documentation! Preferably via pull requests.
|
We are open for contributions, whether that's code or documentation! Preferably via pull requests.
|
||||||
|
|
||||||
We also take **bug reports** at the `issue tracker <https://github.com/tavendo/AutobahnPython/issues>`_.
|
We also take **bug reports** at the `issue tracker <https://github.com/crossbario/autobahn-python/issues>`_.
|
||||||
|
|
||||||
The best place to **ask questions** is on the `mailing list <https://groups.google.com/forum/#!forum/autobahnws>`_. We'd also love to hear about your project and what you are using |ab| for!
|
The best place to **ask questions** is on the `mailing list <https://groups.google.com/forum/#!forum/autobahnws>`_. We'd also love to hear about your project and what you are using |ab| for!
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
WAMP Examples
|
WAMP Examples
|
||||||
=============
|
=============
|
||||||
|
|
||||||
**NOTE** that for all examples you will **need to run a router**. We develop `Crossbar.io <http://crossbar.io/docs>`_ and there are `other routers <http://wamp.ws/implementations/#routers>`_ available as well. We include a working `Crossbar.io <http://crossbar.io/docs>`_ configuration in the `examples/router/ subdirectory <https://github.com/tavendo/AutobahnPython/tree/master/examples/router>`_ as well as `instructions on how to run it <https://github.com/tavendo/AutobahnPython/blob/master/examples/running-the-examples.md>`_.
|
**NOTE** that for all examples you will **need to run a router**. We develop `Crossbar.io <http://crossbar.io/docs>`_ and there are `other routers <http://wamp.ws/implementations/#routers>`_ available as well. We include a working `Crossbar.io <http://crossbar.io/docs>`_ configuration in the `examples/router/ subdirectory <https://github.com/crossbario/autobahn-python/tree/master/examples/router>`_ as well as `instructions on how to run it <https://github.com/crossbario/autobahn-python/blob/master/examples/running-the-examples.md>`_.
|
||||||
|
|
||||||
Overview of Examples
|
Overview of Examples
|
||||||
++++++++++++++++++++
|
++++++++++++++++++++
|
||||||
@@ -41,31 +41,31 @@ There is a script (``./examples/run-all-examples.py``) which runs all the WAMP e
|
|||||||
Publish & Subscribe (PubSub)
|
Publish & Subscribe (PubSub)
|
||||||
++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++
|
||||||
|
|
||||||
* Basic `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/pubsub/basic>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/pubsub/basic>`__ - Demonstrates basic publish and subscribe.
|
* Basic `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/pubsub/basic>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/pubsub/basic>`__ - Demonstrates basic publish and subscribe.
|
||||||
|
|
||||||
* Complex `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/pubsub/complex>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/pubsub/complex>`__ - Demonstrates publish and subscribe with complex events.
|
* Complex `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/pubsub/complex>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/pubsub/complex>`__ - Demonstrates publish and subscribe with complex events.
|
||||||
|
|
||||||
* Options `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/pubsub/options>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/pubsub/options>`__ - Using options with PubSub.
|
* Options `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/pubsub/options>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/pubsub/options>`__ - Using options with PubSub.
|
||||||
|
|
||||||
* Unsubscribe `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/pubsub/unsubscribe>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/pubsub/unsubscribe>`__ - Cancel a subscription to a topic.
|
* Unsubscribe `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/pubsub/unsubscribe>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/pubsub/unsubscribe>`__ - Cancel a subscription to a topic.
|
||||||
|
|
||||||
|
|
||||||
Remote Procedure Calls (RPC)
|
Remote Procedure Calls (RPC)
|
||||||
++++++++++++++++++++++++++++
|
++++++++++++++++++++++++++++
|
||||||
|
|
||||||
* Time Service `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/timeservice>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/timeservice>`__ - A trivial time service - demonstrates basic remote procedure feature.
|
* Time Service `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/timeservice>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/timeservice>`__ - A trivial time service - demonstrates basic remote procedure feature.
|
||||||
|
|
||||||
* Slow Square `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/slowsquare>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/slowsquare>`__ - Demonstrates procedures which return promises and return asynchronously.
|
* Slow Square `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/slowsquare>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/slowsquare>`__ - Demonstrates procedures which return promises and return asynchronously.
|
||||||
|
|
||||||
* Arguments `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/arguments>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/arguments>`__ - Demonstrates all variants of call arguments.
|
* Arguments `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/arguments>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/arguments>`__ - Demonstrates all variants of call arguments.
|
||||||
|
|
||||||
* Complex Result `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/complex>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/complex>`__ - Demonstrates complex call results (call results with more than one positional or keyword results).
|
* Complex Result `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/complex>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/complex>`__ - Demonstrates complex call results (call results with more than one positional or keyword results).
|
||||||
|
|
||||||
* Errors `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/errors>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/errors>`__ - Demonstrates error raising and catching over remote procedures.
|
* Errors `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/errors>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/errors>`__ - Demonstrates error raising and catching over remote procedures.
|
||||||
|
|
||||||
* Progressive Results `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/progress>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/progress>`__ - Demonstrates calling remote procedures that produce progressive results.
|
* Progressive Results `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/progress>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/progress>`__ - Demonstrates calling remote procedures that produce progressive results.
|
||||||
|
|
||||||
* Options `Twisted <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/wamp/rpc/options>`__ - `asyncio <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/wamp/rpc/options>`__ - Using options with RPC.
|
* Options `Twisted <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/wamp/rpc/options>`__ - `asyncio <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/wamp/rpc/options>`__ - Using options with RPC.
|
||||||
|
|
||||||
|
|
||||||
I'm Confused, Just Tell Me What To Run
|
I'm Confused, Just Tell Me What To Run
|
||||||
@@ -74,7 +74,7 @@ I'm Confused, Just Tell Me What To Run
|
|||||||
If all that is too many options to consider, you want to do this:
|
If all that is too many options to consider, you want to do this:
|
||||||
|
|
||||||
1. Open 3 terminals
|
1. Open 3 terminals
|
||||||
2. In terminal 1, `setup and run a local Crossbar <https://github.com/tavendo/AutobahnPython/blob/master/examples/running-the-examples.md>`_ in the root of your Autobahn checkout.
|
2. In terminal 1, `setup and run a local Crossbar <https://github.com/crossbario/autobahn-python/blob/master/examples/running-the-examples.md>`_ in the root of your Autobahn checkout.
|
||||||
3. In terminals 2 and 3, go to the root of your Autobahn checkout and activate the virtualenv from step 2 (``source venv-autobahn/bin/activate``)
|
3. In terminals 2 and 3, go to the root of your Autobahn checkout and activate the virtualenv from step 2 (``source venv-autobahn/bin/activate``)
|
||||||
4. In terminal 2 run ``python ./examples/twisted/wamp/rpc/arguments/backend.py``
|
4. In terminal 2 run ``python ./examples/twisted/wamp/rpc/arguments/backend.py``
|
||||||
5. In terminal 3 run ``python ./examples/twisted/wamp/rpc/arguments/frontend.py``
|
5. In terminal 3 run ``python ./examples/twisted/wamp/rpc/arguments/frontend.py``
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ Basic Examples
|
|||||||
Echo
|
Echo
|
||||||
....
|
....
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo>`__ / `asyncio <https://github.com/tavendo/AutobahnPython/blob/master/examples/asyncio/websocket/echo>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo>`__ / `asyncio <https://github.com/crossbario/autobahn-python/blob/master/examples/asyncio/websocket/echo>`__
|
||||||
|
|
||||||
A simple WebSocket echo server and client.
|
A simple WebSocket echo server and client.
|
||||||
|
|
||||||
Slow Square
|
Slow Square
|
||||||
............
|
............
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/slowsquare>`__ / `asyncio <https://github.com/tavendo/AutobahnPython/blob/master/examples/asyncio/websocket/slowsquare>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/slowsquare>`__ / `asyncio <https://github.com/crossbario/autobahn-python/blob/master/examples/asyncio/websocket/slowsquare>`__
|
||||||
|
|
||||||
This example shows a WebSocket server that will receive a JSON encode float over WebSocket, slowly compute the square, and send back the result.
|
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.
|
The example is intended to demonstrate how to use co-routines inside WebSocket handlers.
|
||||||
@@ -28,7 +28,7 @@ The example is intended to demonstrate how to use co-routines inside WebSocket h
|
|||||||
Testee
|
Testee
|
||||||
......
|
......
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/testee>`__ / `asyncio <https://github.com/tavendo/AutobahnPython/blob/master/examples/asyncio/websocket/testee>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/testee>`__ / `asyncio <https://github.com/crossbario/autobahn-python/blob/master/examples/asyncio/websocket/testee>`__
|
||||||
|
|
||||||
The example implements a *testee* for testing against `Autobahn|Testsuite <http://autobahn.ws/testsuite>`_.
|
The example implements a *testee* for testing against `Autobahn|Testsuite <http://autobahn.ws/testsuite>`_.
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Additional Examples
|
|||||||
Secure WebSocket
|
Secure WebSocket
|
||||||
................
|
................
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_tls>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_tls>`__
|
||||||
|
|
||||||
How to run WebSocket over TLS ("wss").
|
How to run WebSocket over TLS ("wss").
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ How to run WebSocket over TLS ("wss").
|
|||||||
WebSocket and Twisted Web
|
WebSocket and Twisted Web
|
||||||
.........................
|
.........................
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_site>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_site>`__
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
@@ -61,7 +61,7 @@ How to run WebSocket under Twisted Web. This is a very powerful feature, as it a
|
|||||||
Twisted Web, WebSocket and WSGI
|
Twisted Web, WebSocket and WSGI
|
||||||
...............................
|
...............................
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_wsgi>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_wsgi>`__
|
||||||
|
|
||||||
This example shows how to run Flask (or any other WSGI compliant Web thing) under Twisted Web and combine that with WebSocket.
|
This example shows how to run Flask (or any other WSGI compliant Web thing) under Twisted Web and combine that with WebSocket.
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ This example shows how to run Flask (or any other WSGI compliant Web thing) unde
|
|||||||
Secure WebSocket and Twisted Web
|
Secure WebSocket and Twisted Web
|
||||||
................................
|
................................
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_site_tls>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_site_tls>`__
|
||||||
|
|
||||||
A variant of the previous example that runs a HTTPS server with secure WebSocket on a subpath.
|
A variant of the previous example that runs a HTTPS server with secure WebSocket on a subpath.
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ A variant of the previous example that runs a HTTPS server with secure WebSocket
|
|||||||
WebSocket Ping-Pong
|
WebSocket Ping-Pong
|
||||||
...................
|
...................
|
||||||
|
|
||||||
`Twisted <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/ping>`__
|
`Twisted <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/ping>`__
|
||||||
|
|
||||||
The example demonstrates how to trigger and process WebSocket pings and pongs.
|
The example demonstrates how to trigger and process WebSocket pings and pongs.
|
||||||
|
|
||||||
@@ -85,16 +85,16 @@ The example demonstrates how to trigger and process WebSocket pings and pongs.
|
|||||||
More
|
More
|
||||||
....
|
....
|
||||||
|
|
||||||
* `WebSocket Authentication with Mozilla Persona <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/auth_persona>`_
|
* `WebSocket Authentication with Mozilla Persona <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/auth_persona>`_
|
||||||
* `Broadcasting over WebSocket <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/broadcast>`_
|
* `Broadcasting over WebSocket <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/broadcast>`_
|
||||||
* `WebSocket Compression <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_compressed>`_
|
* `WebSocket Compression <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_compressed>`_
|
||||||
* `WebSocket over Twisted Endpoints <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_endpoints>`_
|
* `WebSocket over Twisted Endpoints <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_endpoints>`_
|
||||||
* `Using HTTP Headers with WebSocket <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_httpheaders>`_
|
* `Using HTTP Headers with WebSocket <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_httpheaders>`_
|
||||||
* `WebSocket on Multicore <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_multicore>`_
|
* `WebSocket on Multicore <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_multicore>`_
|
||||||
* `WebSocket as a Twisted Service <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_service>`_
|
* `WebSocket as a Twisted Service <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_service>`_
|
||||||
* `WebSocket Echo Variants <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_variants>`_
|
* `WebSocket Echo Variants <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_variants>`_
|
||||||
* `WebSocket Fallbacks <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/echo_wsfallbacks>`_
|
* `WebSocket Fallbacks <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/echo_wsfallbacks>`_
|
||||||
* `Using multiple WebSocket Protocols <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/multiproto>`_
|
* `Using multiple WebSocket Protocols <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/multiproto>`_
|
||||||
* `Streaming WebSocket <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/streaming>`_
|
* `Streaming WebSocket <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/streaming>`_
|
||||||
* `Wrapping Twisted Protocol/Factories over WebSocket <https://github.com/tavendo/AutobahnPython/blob/master/examples/twisted/websocket/wrapping>`_
|
* `Wrapping Twisted Protocol/Factories over WebSocket <https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/websocket/wrapping>`_
|
||||||
* `Using wxPython with Autobahn <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wxpython>`_
|
* `Using wxPython with Autobahn <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/wxpython>`_
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ You'll see how to create WebSocket server (":ref:`creating-websocket-servers`")
|
|||||||
|
|
||||||
*Resources:*
|
*Resources:*
|
||||||
|
|
||||||
* Example Code for this Guide: `Twisted-based <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo>`_ or `asyncio-based <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo>`_
|
* Example Code for this Guide: `Twisted-based <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo>`_ or `asyncio-based <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/echo>`_
|
||||||
* More :ref:`WebSocket Examples <websocket_examples>`
|
* More :ref:`WebSocket Examples <websocket_examples>`
|
||||||
|
|
||||||
.. _creating-websocket-servers:
|
.. _creating-websocket-servers:
|
||||||
@@ -226,8 +226,8 @@ What we are doing here is
|
|||||||
|
|
||||||
You can find complete code for above examples here:
|
You can find complete code for above examples here:
|
||||||
|
|
||||||
* `WebSocket Echo (Twisted-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo>`_
|
* `WebSocket Echo (Twisted-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo>`_
|
||||||
* `WebSocket Echo (Asyncio-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo>`_
|
* `WebSocket Echo (Asyncio-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/echo>`_
|
||||||
|
|
||||||
|
|
||||||
.. _connection-lifecycle:
|
.. _connection-lifecycle:
|
||||||
@@ -486,8 +486,8 @@ What we are doing here is
|
|||||||
|
|
||||||
You can find complete code for above examples here:
|
You can find complete code for above examples here:
|
||||||
|
|
||||||
* `WebSocket Echo (Twisted-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo>`_
|
* `WebSocket Echo (Twisted-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo>`_
|
||||||
* `WebSocket Echo (Asyncio-based) <https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo>`_
|
* `WebSocket Echo (Asyncio-based) <https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/echo>`_
|
||||||
|
|
||||||
|
|
||||||
Upgrading
|
Upgrading
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ Autobahn|Python supports the following WebSocket extensions for compression:
|
|||||||
* permessage-bzip2
|
* permessage-bzip2
|
||||||
* permessage-snappy
|
* permessage-snappy
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_compressed>`_.
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_compressed>`_.
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ Twisted Reactor
|
|||||||
Wrapping Factory & Protocol
|
Wrapping Factory & Protocol
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wrapping>`__
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/wrapping>`__
|
||||||
|
|
||||||
|
|
||||||
* :class:`autobahn.twisted.websocket.WrappingWebSocketServerFactory`
|
* :class:`autobahn.twisted.websocket.WrappingWebSocketServerFactory`
|
||||||
@@ -36,7 +36,7 @@ You can find a complete example `here <https://github.com/tavendo/AutobahnPython
|
|||||||
Twisted Endpoints
|
Twisted Endpoints
|
||||||
=================
|
=================
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_endpoints>`__
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_endpoints>`__
|
||||||
|
|
||||||
|
|
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ Twisted Web & WSGI
|
|||||||
|
|
||||||
AutobahnPython provides integration with Twisted Web via a special `WebSocketResource` that can be added to Twisted Web resource hierarchies.
|
AutobahnPython provides integration with Twisted Web via a special `WebSocketResource` that can be added to Twisted Web resource hierarchies.
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_site>`__
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_site>`__
|
||||||
|
|
||||||
* :class:`autobahn.twisted.resource.WebSocketResource`
|
* :class:`autobahn.twisted.resource.WebSocketResource`
|
||||||
* :class:`autobahn.twisted.resource.HTTPChannelHixie76Aware`
|
* :class:`autobahn.twisted.resource.HTTPChannelHixie76Aware`
|
||||||
@@ -54,7 +54,7 @@ You can find a complete example `here <https://github.com/tavendo/AutobahnPython
|
|||||||
|
|
||||||
The Twisted Web support of AutobahnPython also allows you add WebSocket as part of a WSGI application that runs under Twisted.
|
The Twisted Web support of AutobahnPython also allows you add WebSocket as part of a WSGI application that runs under Twisted.
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_wsgi>`__
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_wsgi>`__
|
||||||
|
|
||||||
* :class:`autobahn.twisted.resource.WSGIRootResource`
|
* :class:`autobahn.twisted.resource.WSGIRootResource`
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ You can find a complete example `here <https://github.com/tavendo/AutobahnPython
|
|||||||
Flash Policy Server
|
Flash Policy Server
|
||||||
===================
|
===================
|
||||||
|
|
||||||
You can find a complete example `here <https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_wsfallbacks>`__
|
You can find a complete example `here <https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_wsfallbacks>`__
|
||||||
|
|
||||||
|
|
||||||
* :class:`autobahn.twisted.flashpolicy.FlashPolicyProtocol`
|
* :class:`autobahn.twisted.flashpolicy.FlashPolicyProtocol`
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ There are many more examples showing options and advanced features:
|
|||||||
|
|
||||||
* WAMP application components can be run in servers and clients without any modification to your component class.
|
* WAMP application components can be run in servers and clients without any modification to your component class.
|
||||||
|
|
||||||
* `AutobahnJS`_ allows you to write WAMP application components in JavaScript which run in browsers and Nodejs. Here is how above example `looks like <https://github.com/tavendo/AutobahnJS/#show-me-some-code>`_ in JavaScript.
|
* `AutobahnJS`_ allows you to write WAMP application components in JavaScript which run in browsers and Nodejs. Here is how above example `looks like <https://github.com/crossbario/autobahn-js/#show-me-some-code>`_ in JavaScript.
|
||||||
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ commands = [
|
|||||||
colors.red('# http://autobahn.ws example'),
|
colors.red('# http://autobahn.ws example'),
|
||||||
colors.red('# (Note there are many other examples to try)'),
|
colors.red('# (Note there are many other examples to try)'),
|
||||||
colors.red('#'),
|
colors.red('#'),
|
||||||
colors.red("# I presume you've got a clone of https://github.com/tavendo/AutobahnPython"),
|
colors.red("# I presume you've got a clone of https://github.com/crossbario/autobahn-python"),
|
||||||
colors.red("# in ~/autobahn-python"),
|
colors.red("# in ~/autobahn-python"),
|
||||||
"sleep 5",
|
"sleep 5",
|
||||||
"clear",
|
"clear",
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ It also includes a WebSocket client that will send a WebSocket message every sec
|
|||||||
|
|
||||||
Lastly, a HTML5 client is also included.
|
Lastly, a HTML5 client is also included.
|
||||||
|
|
||||||
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/echo).
|
This example uses the Asyncio integration of **Autobahn**|Python. You can find the corresponding example using the Twisted integration [here](https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo).
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This example shows a WebSocket server that will receive a JSON encode float over
|
|||||||
|
|
||||||
This example is intended to demonstrate how to use coroutines inside WebSocket handlers.
|
This example is intended to demonstrate how to use coroutines inside WebSocket handlers.
|
||||||
|
|
||||||
> 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).
|
> This example uses the Asyncio integration of **Autobahn**|Python. You can find the corresponding example using the Twisted integration [here](https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/slowsquare).
|
||||||
>
|
>
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ By default, **all examples are set up to use a local Crossbar instance**. You ca
|
|||||||
If you do not yet have a `virtualenv` to run the examples with, you can do something like:
|
If you do not yet have a `virtualenv` to run the examples with, you can do something like:
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
git clone https://github.com/tavendo/AutobahnPython.git
|
git clone https://github.com/crossbario/autobahn-python.git
|
||||||
cd ./AutobahnPython/
|
cd ./AutobahnPython/
|
||||||
virtualenv venv-autobahn
|
virtualenv venv-autobahn
|
||||||
source venv-autobahn/bin/activate
|
source venv-autobahn/bin/activate
|
||||||
|
|||||||
@@ -268,4 +268,4 @@ this,J.call(arguments,1))}function h(a,b,c){return x.all(c).then(function(c){ret
|
|||||||
v=a("./lib/decorators/progress"),y=a("./lib/decorators/with"),H=a("./lib/decorators/unhandledRejection"),f=a("./lib/TimeoutError"),x=[n,l,p,w,v,P,y,g,H].reduce(function(a,b){return b(a)},a("./lib/Promise")),J=Array.prototype.slice;b.promise=function(a){return new x(a)};b.resolve=x.resolve;b.reject=x.reject;b.lift=e;b["try"]=d;b.attempt=d;b.iterate=x.iterate;b.unfold=x.unfold;b.join=function(){return x.all(arguments)};b.all=function(a){return b(a,x.all)};b.settle=function(a){return b(a,x.settle)};
|
v=a("./lib/decorators/progress"),y=a("./lib/decorators/with"),H=a("./lib/decorators/unhandledRejection"),f=a("./lib/TimeoutError"),x=[n,l,p,w,v,P,y,g,H].reduce(function(a,b){return b(a)},a("./lib/Promise")),J=Array.prototype.slice;b.promise=function(a){return new x(a)};b.resolve=x.resolve;b.reject=x.reject;b.lift=e;b["try"]=d;b.attempt=d;b.iterate=x.iterate;b.unfold=x.unfold;b.join=function(){return x.all(arguments)};b.all=function(a){return b(a,x.all)};b.settle=function(a){return b(a,x.settle)};
|
||||||
b.any=e(x.any);b.some=e(x.some);b.map=function(a,d){return b(a,function(a){return x.map(a,d)})};b.reduce=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduce.apply(x,e)})};b.reduceRight=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduceRight.apply(x,e)})};b.isPromiseLike=function(a){return a&&"function"===typeof a.then};b.Promise=x;b.defer=function(){return new k};b.TimeoutError=f;return b})})(function(b){p.exports=b(h)})},
|
b.any=e(x.any);b.some=e(x.some);b.map=function(a,d){return b(a,function(a){return x.map(a,d)})};b.reduce=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduce.apply(x,e)})};b.reduceRight=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduceRight.apply(x,e)})};b.isPromiseLike=function(a){return a&&"function"===typeof a.then};b.Promise=x;b.defer=function(){return new k};b.TimeoutError=f;return b})})(function(b){p.exports=b(h)})},
|
||||||
{"./lib/Promise":55,"./lib/TimeoutError":57,"./lib/decorators/array":59,"./lib/decorators/flow":60,"./lib/decorators/fold":61,"./lib/decorators/inspect":62,"./lib/decorators/iterate":63,"./lib/decorators/progress":64,"./lib/decorators/timed":65,"./lib/decorators/unhandledRejection":66,"./lib/decorators/with":67}],78:[function(h,p,k){function b(b,e,d){return e?new a(b,e):new a(b)}h=function(){return this}();var a=h.WebSocket||h.MozWebSocket;p.exports=a?b:null;a&&(b.prototype=a.prototype)},{}],79:[function(h,
|
{"./lib/Promise":55,"./lib/TimeoutError":57,"./lib/decorators/array":59,"./lib/decorators/flow":60,"./lib/decorators/fold":61,"./lib/decorators/inspect":62,"./lib/decorators/iterate":63,"./lib/decorators/progress":64,"./lib/decorators/timed":65,"./lib/decorators/unhandledRejection":66,"./lib/decorators/with":67}],78:[function(h,p,k){function b(b,e,d){return e?new a(b,e):new a(b)}h=function(){return this}();var a=h.WebSocket||h.MozWebSocket;p.exports=a?b:null;a&&(b.prototype=a.prototype)},{}],79:[function(h,
|
||||||
p,k){p.exports={name:"autobahn",version:"0.9.5",description:"An implementation of The Web Application Messaging Protocol (WAMP).",main:"index.js",scripts:{test:"nodeunit test/test.js"},dependencies:{when:">= 2.8.0",ws:">= 0.4.31","crypto-js":">= 3.1.2-2"},devDependencies:{browserify:">= 3.28.1",nodeunit:">= 0.8.6"},repository:{type:"git",url:"git://github.com/tavendo/AutobahnJS.git"},keywords:["WAMP","WebSocket","RPC","PubSub"],author:"Tavendo GmbH",license:"MIT"}},{}]},{},[4])(4)});
|
p,k){p.exports={name:"autobahn",version:"0.9.5",description:"An implementation of The Web Application Messaging Protocol (WAMP).",main:"index.js",scripts:{test:"nodeunit test/test.js"},dependencies:{when:">= 2.8.0",ws:">= 0.4.31","crypto-js":">= 3.1.2-2"},devDependencies:{browserify:">= 3.28.1",nodeunit:">= 0.8.6"},repository:{type:"git",url:"git://github.com/crossbario/autobahn-js.git"},keywords:["WAMP","WebSocket","RPC","PubSub"],author:"Tavendo GmbH",license:"MIT"}},{}]},{},[4])(4)});
|
||||||
|
|||||||
@@ -268,4 +268,4 @@ this,J.call(arguments,1))}function h(a,b,c){return x.all(c).then(function(c){ret
|
|||||||
v=a("./lib/decorators/progress"),y=a("./lib/decorators/with"),H=a("./lib/decorators/unhandledRejection"),f=a("./lib/TimeoutError"),x=[n,l,p,w,v,P,y,g,H].reduce(function(a,b){return b(a)},a("./lib/Promise")),J=Array.prototype.slice;b.promise=function(a){return new x(a)};b.resolve=x.resolve;b.reject=x.reject;b.lift=e;b["try"]=d;b.attempt=d;b.iterate=x.iterate;b.unfold=x.unfold;b.join=function(){return x.all(arguments)};b.all=function(a){return b(a,x.all)};b.settle=function(a){return b(a,x.settle)};
|
v=a("./lib/decorators/progress"),y=a("./lib/decorators/with"),H=a("./lib/decorators/unhandledRejection"),f=a("./lib/TimeoutError"),x=[n,l,p,w,v,P,y,g,H].reduce(function(a,b){return b(a)},a("./lib/Promise")),J=Array.prototype.slice;b.promise=function(a){return new x(a)};b.resolve=x.resolve;b.reject=x.reject;b.lift=e;b["try"]=d;b.attempt=d;b.iterate=x.iterate;b.unfold=x.unfold;b.join=function(){return x.all(arguments)};b.all=function(a){return b(a,x.all)};b.settle=function(a){return b(a,x.settle)};
|
||||||
b.any=e(x.any);b.some=e(x.some);b.map=function(a,d){return b(a,function(a){return x.map(a,d)})};b.reduce=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduce.apply(x,e)})};b.reduceRight=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduceRight.apply(x,e)})};b.isPromiseLike=function(a){return a&&"function"===typeof a.then};b.Promise=x;b.defer=function(){return new k};b.TimeoutError=f;return b})})(function(b){p.exports=b(h)})},
|
b.any=e(x.any);b.some=e(x.some);b.map=function(a,d){return b(a,function(a){return x.map(a,d)})};b.reduce=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduce.apply(x,e)})};b.reduceRight=function(a,d){var e=J.call(arguments,1);return b(a,function(a){e.unshift(a);return x.reduceRight.apply(x,e)})};b.isPromiseLike=function(a){return a&&"function"===typeof a.then};b.Promise=x;b.defer=function(){return new k};b.TimeoutError=f;return b})})(function(b){p.exports=b(h)})},
|
||||||
{"./lib/Promise":55,"./lib/TimeoutError":57,"./lib/decorators/array":59,"./lib/decorators/flow":60,"./lib/decorators/fold":61,"./lib/decorators/inspect":62,"./lib/decorators/iterate":63,"./lib/decorators/progress":64,"./lib/decorators/timed":65,"./lib/decorators/unhandledRejection":66,"./lib/decorators/with":67}],78:[function(h,p,k){function b(b,e,d){return e?new a(b,e):new a(b)}h=function(){return this}();var a=h.WebSocket||h.MozWebSocket;p.exports=a?b:null;a&&(b.prototype=a.prototype)},{}],79:[function(h,
|
{"./lib/Promise":55,"./lib/TimeoutError":57,"./lib/decorators/array":59,"./lib/decorators/flow":60,"./lib/decorators/fold":61,"./lib/decorators/inspect":62,"./lib/decorators/iterate":63,"./lib/decorators/progress":64,"./lib/decorators/timed":65,"./lib/decorators/unhandledRejection":66,"./lib/decorators/with":67}],78:[function(h,p,k){function b(b,e,d){return e?new a(b,e):new a(b)}h=function(){return this}();var a=h.WebSocket||h.MozWebSocket;p.exports=a?b:null;a&&(b.prototype=a.prototype)},{}],79:[function(h,
|
||||||
p,k){p.exports={name:"autobahn",version:"0.9.5",description:"An implementation of The Web Application Messaging Protocol (WAMP).",main:"index.js",scripts:{test:"nodeunit test/test.js"},dependencies:{when:">= 2.8.0",ws:">= 0.4.31","crypto-js":">= 3.1.2-2"},devDependencies:{browserify:">= 3.28.1",nodeunit:">= 0.8.6"},repository:{type:"git",url:"git://github.com/tavendo/AutobahnJS.git"},keywords:["WAMP","WebSocket","RPC","PubSub"],author:"Tavendo GmbH",license:"MIT"}},{}]},{},[4])(4)});
|
p,k){p.exports={name:"autobahn",version:"0.9.5",description:"An implementation of The Web Application Messaging Protocol (WAMP).",main:"index.js",scripts:{test:"nodeunit test/test.js"},dependencies:{when:">= 2.8.0",ws:">= 0.4.31","crypto-js":">= 3.1.2-2"},devDependencies:{browserify:">= 3.28.1",nodeunit:">= 0.8.6"},repository:{type:"git",url:"git://github.com/crossbario/autobahn-js.git"},keywords:["WAMP","WebSocket","RPC","PubSub"],author:"Tavendo GmbH",license:"MIT"}},{}]},{},[4])(4)});
|
||||||
|
|||||||
17
examples/twisted/wamp/basic/rpc/cancel/__init__.py
Normal file
17
examples/twisted/wamp/basic/rpc/cancel/__init__.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
###############################################################################
|
||||||
|
##
|
||||||
|
## Copyright (C) 2014 Tavendo GmbH
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
##
|
||||||
|
###############################################################################
|
||||||
9
examples/twisted/wamp/basic/rpc/cancel/backend.html
Normal file
9
examples/twisted/wamp/basic/rpc/cancel/backend.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h1>RPC Arguments Backend</h1>
|
||||||
|
<p>Open JavaScript console to watch output.</p>
|
||||||
|
<script src="https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz"></script>
|
||||||
|
<script src="backend.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
63
examples/twisted/wamp/basic/rpc/cancel/backend.js
Normal file
63
examples/twisted/wamp/basic/rpc/cancel/backend.js
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
try {
|
||||||
|
var autobahn = require('autobahn');
|
||||||
|
var when = require('when');
|
||||||
|
} catch (e) {
|
||||||
|
// When running in browser, AutobahnJS will
|
||||||
|
// be included without a module system
|
||||||
|
var when = autobahn.when;
|
||||||
|
}
|
||||||
|
|
||||||
|
var connection = new autobahn.Connection({
|
||||||
|
url: 'ws://127.0.0.1:8080/ws',
|
||||||
|
realm: 'realm1'}
|
||||||
|
);
|
||||||
|
|
||||||
|
connection.onopen = function (session) {
|
||||||
|
|
||||||
|
function ping() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function add2(args) {
|
||||||
|
return args[0] + args[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
function stars(args, kwargs) {
|
||||||
|
kwargs = kwargs || {};
|
||||||
|
kwargs.nick = kwargs.nick || "somebody";
|
||||||
|
kwargs.stars = kwargs.stars || 0;
|
||||||
|
return kwargs.nick + " starred " + kwargs.stars + "x";
|
||||||
|
}
|
||||||
|
|
||||||
|
var _orders = [];
|
||||||
|
for (var i = 0; i < 50; ++i) _orders.push(i);
|
||||||
|
|
||||||
|
function orders(args, kwargs) {
|
||||||
|
kwargs = kwargs || {};
|
||||||
|
kwargs.limit = kwargs.limit || 5;
|
||||||
|
return _orders.slice(0, kwargs.limit);
|
||||||
|
}
|
||||||
|
|
||||||
|
function arglen(args, kwargs) {
|
||||||
|
args = args || [];
|
||||||
|
kwargs = kwargs || {};
|
||||||
|
return [args.length, Object.keys(kwargs).length];
|
||||||
|
}
|
||||||
|
|
||||||
|
var dl = [];
|
||||||
|
|
||||||
|
dl.push(session.register('com.arguments.ping', ping));
|
||||||
|
dl.push(session.register('com.arguments.add2', add2));
|
||||||
|
dl.push(session.register('com.arguments.stars', stars));
|
||||||
|
dl.push(session.register('com.arguments.orders', orders));
|
||||||
|
dl.push(session.register('com.arguments.arglen', arglen));
|
||||||
|
|
||||||
|
when.all(dl).then(
|
||||||
|
function () {
|
||||||
|
console.log("All registered.");
|
||||||
|
},
|
||||||
|
function () {
|
||||||
|
console.log("Registration failed!", arguments);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
connection.open();
|
||||||
61
examples/twisted/wamp/basic/rpc/cancel/backend.py
Normal file
61
examples/twisted/wamp/basic/rpc/cancel/backend.py
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
###############################################################################
|
||||||
|
##
|
||||||
|
## Copyright (C) 2014 Tavendo GmbH
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
##
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
from twisted.internet.defer import inlineCallbacks
|
||||||
|
|
||||||
|
from autobahn.twisted.wamp import ApplicationSession
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Component(ApplicationSession):
|
||||||
|
"""
|
||||||
|
An application component providing procedures with different kinds of arguments.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@inlineCallbacks
|
||||||
|
def onJoin(self, details):
|
||||||
|
print("session attached")
|
||||||
|
|
||||||
|
def ping():
|
||||||
|
return
|
||||||
|
|
||||||
|
def add2(a, b):
|
||||||
|
return a + b
|
||||||
|
|
||||||
|
def stars(nick = "somebody", stars = 0):
|
||||||
|
return u"{} starred {}x".format(nick, stars)
|
||||||
|
|
||||||
|
def orders(product, limit = 5):
|
||||||
|
return [u"Product {}".format(i) for i in range(50)][:limit]
|
||||||
|
|
||||||
|
def arglen(*args, **kwargs):
|
||||||
|
return [len(args), len(kwargs)]
|
||||||
|
|
||||||
|
yield self.register(ping, u'com.arguments.ping')
|
||||||
|
yield self.register(add2, u'com.arguments.add2')
|
||||||
|
yield self.register(stars, u'com.arguments.stars')
|
||||||
|
yield self.register(orders, u'com.arguments.orders')
|
||||||
|
yield self.register(arglen, u'com.arguments.arglen')
|
||||||
|
print("procedures registered")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
|
runner = ApplicationRunner("ws://127.0.0.1:8080/ws", "realm1")
|
||||||
|
runner.run(Component)
|
||||||
9
examples/twisted/wamp/basic/rpc/cancel/frontend.html
Normal file
9
examples/twisted/wamp/basic/rpc/cancel/frontend.html
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h1>RPC Arguments Frontend</h1>
|
||||||
|
<p>Open JavaScript console to watch output.</p>
|
||||||
|
<script src="https://autobahn.s3.amazonaws.com/autobahnjs/latest/autobahn.min.jgz"></script>
|
||||||
|
<script src="frontend.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
25
examples/twisted/wamp/basic/rpc/cancel/frontend.js
Normal file
25
examples/twisted/wamp/basic/rpc/cancel/frontend.js
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
try {
|
||||||
|
var autobahn = require('autobahn');
|
||||||
|
var when = require('when');
|
||||||
|
} catch (e) {
|
||||||
|
// When running in browser, AutobahnJS will
|
||||||
|
// be included without a module system
|
||||||
|
var when = autobahn.when;
|
||||||
|
}
|
||||||
|
|
||||||
|
var connection = new autobahn.Connection({
|
||||||
|
url: 'ws://127.0.0.1:8080/ws',
|
||||||
|
realm: 'realm1'}
|
||||||
|
);
|
||||||
|
|
||||||
|
connection.onopen = function (session) {
|
||||||
|
|
||||||
|
session.call('com.arguments.mycall').then(
|
||||||
|
function (res) {
|
||||||
|
console.log("call has returned");
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
connection.open();
|
||||||
83
examples/twisted/wamp/basic/rpc/cancel/frontend.py
Normal file
83
examples/twisted/wamp/basic/rpc/cancel/frontend.py
Normal file
@@ -0,0 +1,83 @@
|
|||||||
|
###############################################################################
|
||||||
|
##
|
||||||
|
## Copyright (C) 2014 Tavendo GmbH
|
||||||
|
##
|
||||||
|
## Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
## you may not use this file except in compliance with the License.
|
||||||
|
## You may obtain a copy of the License at
|
||||||
|
##
|
||||||
|
## http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
##
|
||||||
|
## Unless required by applicable law or agreed to in writing, software
|
||||||
|
## distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
## See the License for the specific language governing permissions and
|
||||||
|
## limitations under the License.
|
||||||
|
##
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
|
from twisted.internet import reactor
|
||||||
|
from twisted.internet.defer import inlineCallbacks
|
||||||
|
|
||||||
|
from autobahn.twisted.wamp import ApplicationSession
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Component(ApplicationSession):
|
||||||
|
"""
|
||||||
|
An application component calling the different backend procedures.
|
||||||
|
"""
|
||||||
|
|
||||||
|
@inlineCallbacks
|
||||||
|
def onJoin(self, details):
|
||||||
|
print("session attached")
|
||||||
|
|
||||||
|
yield self.call(u'com.arguments.ping')
|
||||||
|
print("Pinged!")
|
||||||
|
|
||||||
|
res = yield self.call(u'com.arguments.add2', 2, 3)
|
||||||
|
print("Add2: {}".format(res))
|
||||||
|
|
||||||
|
starred = yield self.call(u'com.arguments.stars')
|
||||||
|
print("Starred 1: {}".format(starred))
|
||||||
|
|
||||||
|
starred = yield self.call(u'com.arguments.stars', nick = u'Homer')
|
||||||
|
print("Starred 2: {}".format(starred))
|
||||||
|
|
||||||
|
starred = yield self.call(u'com.arguments.stars', stars = 5)
|
||||||
|
print("Starred 3: {}".format(starred))
|
||||||
|
|
||||||
|
starred = yield self.call(u'com.arguments.stars', nick = u'Homer', stars = 5)
|
||||||
|
print("Starred 4: {}".format(starred))
|
||||||
|
|
||||||
|
orders = yield self.call(u'com.arguments.orders', u'coffee')
|
||||||
|
print("Orders 1: {}".format(orders))
|
||||||
|
|
||||||
|
orders = yield self.call(u'com.arguments.orders', u'coffee', limit = 10)
|
||||||
|
print("Orders 2: {}".format(orders))
|
||||||
|
|
||||||
|
arglengths = yield self.call(u'com.arguments.arglen')
|
||||||
|
print("Arglen 1: {}".format(arglengths))
|
||||||
|
|
||||||
|
arglengths = yield self.call(u'com.arguments.arglen', 1, 2, 3)
|
||||||
|
print("Arglen 2: {}".format(arglengths))
|
||||||
|
|
||||||
|
arglengths = yield self.call(u'com.arguments.arglen', a = 1, b = 2, c = 3)
|
||||||
|
print("Arglen 3: {}".format(arglengths))
|
||||||
|
|
||||||
|
arglengths = yield self.call(u'com.arguments.arglen', 1, 2, 3, a = 1, b = 2, c = 3)
|
||||||
|
print("Arglen 4: {}".format(arglengths))
|
||||||
|
|
||||||
|
self.leave()
|
||||||
|
|
||||||
|
|
||||||
|
def onDisconnect(self):
|
||||||
|
print("disconnected")
|
||||||
|
reactor.stop()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
from autobahn.twisted.wamp import ApplicationRunner
|
||||||
|
runner = ApplicationRunner("ws://127.0.0.1:8080/ws", "realm1")
|
||||||
|
runner.run(Component)
|
||||||
@@ -6,7 +6,7 @@ It also includes a WebSocket client that will send a WebSocket message every sec
|
|||||||
|
|
||||||
Lastly, a HTML5 client is also included.
|
Lastly, a HTML5 client is also included.
|
||||||
|
|
||||||
This example uses the Twisted integration of **Autobahn**|Python. You can find the corresponding example using the Asyncio integration [here](https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/echo).
|
This example uses the Twisted integration of **Autobahn**|Python. You can find the corresponding example using the Asyncio integration [here](https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/echo).
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ but also over
|
|||||||
and possible other endpoints. This is nifty and flexible.
|
and possible other endpoints. This is nifty and flexible.
|
||||||
|
|
||||||
> This example is about running WebSocket over different stream-based Twisted endpoints.
|
> This example is about running WebSocket over different stream-based Twisted endpoints.
|
||||||
> **Autobahn**|Python also supports running any stream-based Twisted endpoint over WebSocket (which in turn runs over any stream-based underlying Twisted endpoint). Please see [here](https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/wrapping).
|
> **Autobahn**|Python also supports running any stream-based Twisted endpoint over WebSocket (which in turn runs over any stream-based underlying Twisted endpoint). Please see [here](https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/wrapping).
|
||||||
>
|
>
|
||||||
|
|
||||||
## Running WebSocket over TCP
|
## Running WebSocket over TCP
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ This example shows a WebSocket server that will receive a JSON encode float over
|
|||||||
|
|
||||||
This example is intended to demonstrate how to use coroutines inside WebSocket handlers.
|
This example is intended to demonstrate how to use coroutines inside WebSocket handlers.
|
||||||
|
|
||||||
> This example uses the Twisted integration of **Autobahn**|Python. You can find the corresponding example using the Asyncio integration [here](https://github.com/tavendo/AutobahnPython/tree/master/examples/asyncio/websocket/slowsquare).
|
> This example uses the Twisted integration of **Autobahn**|Python. You can find the corresponding example using the Asyncio integration [here](https://github.com/crossbario/autobahn-python/tree/master/examples/asyncio/websocket/slowsquare).
|
||||||
>
|
>
|
||||||
|
|
||||||
## Running
|
## Running
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ That means, you can run any stream-based protocol *over* WebSocket without any m
|
|||||||
Why would you want to do that? For example, to create a VNC, SSH, IRC, IMAP, MQTT or other client for some existing protocol that runs on browsers, and connects to an *unmodified* server.
|
Why would you want to do that? For example, to create a VNC, SSH, IRC, IMAP, MQTT or other client for some existing protocol that runs on browsers, and connects to an *unmodified* server.
|
||||||
|
|
||||||
> This example is about running any stream-based Twisted endpoint over WebSocket.
|
> This example is about running any stream-based Twisted endpoint over WebSocket.
|
||||||
> **Autobahn**|Python also supports running WebSocket over any stream-based Twisted endpoint. Please see [here](https://github.com/tavendo/AutobahnPython/tree/master/examples/twisted/websocket/echo_endpoints).
|
> **Autobahn**|Python also supports running WebSocket over any stream-based Twisted endpoint. Please see [here](https://github.com/crossbario/autobahn-python/tree/master/examples/twisted/websocket/echo_endpoints).
|
||||||
>
|
>
|
||||||
|
|
||||||
## WebSocket Transport Scheme
|
## WebSocket Transport Scheme
|
||||||
|
|||||||
Reference in New Issue
Block a user