Content deleted Content added
→Comparison: SockJS now a proper external link |
|||
(66 intermediate revisions by 50 users not shown) | |||
Line 1:
{{Short description|WebSocket subprotocol registered at IANA}}
{{Advert|date=October 2016}}
'''WAMP''' is a [[WebSocket]] subprotocol registered at [[Internet Assigned Numbers Authority|IANA]],<ref>[https://www.iana.org/assignments/websocket/websocket.xml IANA protocols listing page]</ref> specified<ref>[https://github.com/tavendo/WAMP/blob/master/spec/basic.md WAMP basic profile specifications]</ref> to offer routed [[Remote procedure call|RPC]] and [[Publish–subscribe pattern|PubSub]]. Its design goal<ref>{{cite web|url=https://wamp-proto.org/intro.html|title=Using WAMP you can build distributed systems out of application components which are loosely coupled and communicate in (soft) real-time.}}</ref> is to provide an open [[Web standards|standard]] for soft, real-time message exchange between application components and ease the creation of [[loosely coupled]] architectures based on [[microservices]]. Because of this, it is a suitable [[enterprise service bus]] (ESB),<ref>[http://www.slideshare.net/KSDaemon/wamp-en-exported A few words about WAMP]</ref> fit for developing responsive web applications or coordinating multiple connected IoT devices.<ref>{{cite book|url=https://books.google.com/books?id=JPKGBAAAQBAJ&pg=PA172 |title=In this chapter [...] you will learn about the Web Application Messaging Protocol [...] which provide tools and services for developing IoT solutions|isbn=9780996025515|last1=Bahga|first1=Arshdeep|last2=Madisetti|first2=Vijay|date=9 August 2014}}</ref>
==Characteristics==
Line 5 ⟶ 8:
===Structure===
WAMP requires<ref>
Message [[serialization]] assumes<ref>[https://github.com/tavendo/WAMP/blob/master/spec/basic.md#serializations WAMP serialization]</ref> integers, strings and ordered sequence types are available, and defaults to [[JSON]] as the most common format offering these. Implementations often provide [[MessagePack]] as a faster alternative to JSON at the cost of an additional dependency.<ref>{{cite web|url=https://ksdaemon.github.io/wampy.js/#description|title=Wampy default serializer is JSON, but it also supports msgpack as a serializer, but you need to include msgpack.js as dependency}}</ref>
===Workflow===
WAMP is architectured around
* Clients connect to the router using a transport, establishing a session.
* The router identifies the clients and gives them permissions for the current session.
* Clients send messages to the router which
The clients send these messages using the two high-level primitives that are RPC and PUB/SUB, doing
* '''register''': a client exposes a procedure to be called remotely.
* '''call''': a client asks the router to get the result of an exposed procedure from another client.
* '''subscribe''': a client notifies its interest in a topic.
* '''publish''': a client publishes
This can have subtle variations depending
===Security===
As WAMP uses Websocket, connections can be wrapped in [[Transport Layer Security|
Routers can define
Some realms can
===Routed RPCs===
Unlike with traditional RPCs, which are addressed directly from a caller to the entity offering the procedure (
Registration of RPCs is with the WAMP router, and calls to procedures are similarly issued to the WAMP router. This means first of all that a client can issue all RPCs via the single connection to the WAMP router, and does not need to have any knowledge what client is currently offering the procedure, where that client resides or how to address it. This can indeed change between calls, opening up the possibility for advanced features such as [[Load balancing (computing)|load-balancing]] or fail-over for procedure calls.
It additionally means that all WAMP clients are equal in that they can offer procedures for calling. This avoids the traditional distinction between clients and server backends, and allows architectures where browser clients call procedures on other browser clients, with an API that feels like peer to peer communication.
However, even with multi-tiers architectures, the router is still a single point of failure. For this reason, some router implementation roadmaps include clustering features.<ref>
==Implementations==
Line 50 ⟶ 51:
===Clients===
As WAMP main targets are Web applications and the Internet of Things, the first client implementations are in languages well established in these industries (only WAMP v2 clients listed):
<!-- In each table, link one (often 1st) instance of terms, remove other WP:OVERLINK(s). -->
{| class="wikitable"
|-
! Client library
! Language
|-
| AngularWAMP
| [[JavaScript]] for the [[AngularJS]] framework
|-
|
| [[C++]] 11
|-
| wamplv
| [[LabVIEW]] (G)
|-
| AutobahnJS
| JavaScript ([[Web browser|browser]] and [[Node.js]])
|-
| AutobahnPython
| [[Python (programming language)|Python]]
|-
| wampy
| [[Python (programming language)|Python]]
|-
| Net::WAMP
| [[Perl]]
|-
| backbone.WAMP
| JavaScript for the [[Backbone.js]] library
|-
| CppWAMP
| C++ 11
|-
| Erwa
| [[Erlang (programming language)|Erlang]]
|-
| Jawampa
| [[Java (programming language)|Java]]
|-
| [| Loowy
| [[Lua (programming language)|Lua]]
|-
| MDWamp
| [[Objective-C]]
|-
| Minion
| [[PHP]]
|-
| rx.wamp
| JavaScript for the [[React (JavaScript library)|React]] library
|-
| Thruway
| PHP
|-
| WAMP POCO
| C++
|-
| wampcc
| C++
|-
| WampSharp
| [[C Sharp (programming language)|C#]]
|-
| Wampy.js
| JavaScript (browser only)
|-
| nexus
| [[Go (programming language)|Go]]
|}
The minimum requirements to build a WAMP client are the
However, the persistent nature of
For the same reason, integrating legacy projects can also require work. As an example, most popular Web Python frameworks are using [[Web Server Gateway Interface|WSGI]], a synchronous API, and running a WAMP
===Routers===
While routers can technically be embedded directly into the application code and some client libraries also provide a router, this architecture is discouraged by the specification.<ref>{{cite web|title= Brokers and Dealers are responsible for generic call and event routing and do not run application code.|website=[[GitHub]] |url=https://github.com/tavendo/WAMP/blob/master/spec/basic.md#application-code}}</ref>
{| class="wikitable"
|-
! Router
! Language
|-
| Bondy
| [[Erlang (programming language)|Erlang]]
|-
| Crossbar.io
| Python (CPython and [[PyPy]])
|-
| Erwa
| Erlang
|-
| wampcc
| C++
|-
| Jawampa
| Java
|-
|
| PHP
|-
| wamp.rt
|
|-
|
| C#
|-
| Wiola
| [[Lua (programming language)|Lua]]
|-
|
|
|-
| nexus
| [[Go (programming language)|Go]]
|}
[[Tavendo]], the company from which originated the protocol, is also the author of [[Crossbar.io]], which promotes itself as the de facto router implementation.<ref>{{cite web|title=Crossbar.io is the name of the most full
==Use cases==
Being a
WAMP also targets the IoT, where it is used in the same way as [[MQTT]]<ref>{{cite web|url=https://into.aalto.fi/download/attachments/12324178/Huang_Fuguo_thesis_2.pdf|title=Moreover, we compared WAMP with other registered WebSocket subprotocols (MBWS, SOAP and STOMP) in terms of the related features; and with other potential protocols (CoAP and MQTT), in terms of the related practical deployments.|access-date=2015-01-12|archive-date=2016-05-13|archive-url=https://web.archive.org/web/20160513073741/https://into.aalto.fi/download/attachments/12324178/Huang_Fuguo_thesis_2.pdf|url-status=dead}}</ref> as a light and efficient medium to orchestrate clusters of connected objects. The implementations in various languages make it suitable to control and monitor small devices such as the [[Raspberry Pi]] (in Python) or the Tessel<ref>[https://www.youtube.com/watch?v=WY7KzrRm8XY Tessel alarm app with Crossbar.io]</ref> (in
And last but not least, WAMP can act as an enterprise service bus, serving as the link between
==Evolution==
WAMP is currently in version 2<ref>[
The version 2 of the specification is divided
==Comparison==
The WAMP website claims<ref>[https://wamp-proto.org/comparison.html WAMP compared]</ref> the following selling points for the technology:
* '''Native PubSub''': supports Publish & Subscribe out of the box (no extension required).
* '''RPC''': supports Remote Procedure Calls out of the box (no extension required).
Line 169 ⟶ 199:
On the other hand, WAMP does not try to achieve some goals of other protocols:
* Full object passing like [[Common Object Request Broker Architecture|CORBA]].
* Data synchronization like DDP.
* Peer-to-peer communication like [[ZeroMQ]].
Line 177 ⟶ 206:
Nevertheless, numerous protocols share some characteristics with WAMP:
{| class="wikitable sortable"
! Technology
! PubSub
Line 188 ⟶ 216:
|-
| WAMP
|
|
|
|
|
|
|-
| [[Ajax (programming)|AJAX]]
|
|
|
|
|
|
|-
| [[AMQP]]
|
|
|
|
|
|
|-
| Apache Thrift
|
|
|
|
|
|
|-
|
|
|
|
|
|
|
|-
Line 231 ⟶ 259:
|
|
|
|
|
|-
| [[Data Distribution Service|OMG DDS]]
|
|
|
|
|
|
|-
| [[D-Bus]]
Line 248 ⟶ 276:
|
|
|
|
|-
| CORBA
|
|
|
|
|
|
|-
| [[Distributed Component Object Model|DCOM]]
|
|
|
|
|
|
|-
| [[Java Message Service|Java JMS]]
|
|
|
|
|
|
|-
| [[Java remote method invocation|Java RMI]]
|
|
|
|
|
|
|-
| [[JSON-RPC]]
|
|
|
|
|
|
|-
| [[MQTT]]
|
|
|
| {{ya}}
|
|
|-
| [[Representational state transfer|REST]]
|
|
|
|
|
|
|-
| SOAP
|
|
|
|
|
|
|-
| [[Socket.io]]
|
|
|
|
|
|
|-
|
|
|
|
|
|
|
|-
| [[Streaming Text Oriented Messaging Protocol|STOMP]]
|
|
|
|
|
|
|-
| [[XML-RPC]]
|
|
|
|
|
|
|-
| [[XMPP]]
|
| {{ya}}
|
| {{ya}}
|
|
|-
| [[ZeroMQ]]
|
|
|
|
|
|
|-
| [[Distributed Data Protocol|DDP]]<ref>[https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md
| {{ya}}
|
|
|
|
|
|}
Although, it is important to note that while DDP does
==References==
|