Content deleted Content added
After feedback from some readers, moving around some categories so people can scan the article more easily. I have several other modifications to make, but I'll make them separatly so people can revert small increments if needed. |
|||
(70 intermediate revisions by 53 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 dispatches them to the proper targets using the attached URIs.
The clients send these messages using the two high-level primitives that are RPC and PUB/SUB, doing four core interactions:
* '''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 information about this topic.
This can have subtle variations depending on the underlying transport.<ref>{{cite web|title=The Long-Poll Transport is able to transmit a WAMP session over plain old HTTP 1.0/1.1. This is realized by the Client issuing HTTP/POSTs requests, one for sending, and one for receiving|website=[[GitHub]] |url=https://github.com/tavendo/WAMP/blob/master/spec/advanced.md#long-poll-transport}}</ref> However, implementation details are hidden to the end-user who only programs with the two high-level primitives that are RPC and PubSub.
===Security===
As WAMP uses Websocket, connections can be wrapped in [[Transport Layer Security|
Routers can define realms as administrative domains, and clients must specify which realm they want to join upon connection. Once joined, the realm will act as a [[namespace]], preventing clients connected to a realm from using IDs defined in another for RPC and PubSub. Realms also have permissions attached and can limit the clients to one subset of the REGISTER/CALL/PubSub actions available.
Some realms can only be joined by authenticated clients, using various authentication methods such as using [[X.509|TLS certificate]], [[HTTP cookie|cookies]] or a simple ticket.
===Routed RPCs===
Unlike with traditional RPCs, which are addressed directly from a caller to the entity offering the procedure (typically a server backend) and are strictly unidirectional (client-to-server), RPCs in WAMP are routed by a middleware and work bidirectionally.
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>{{Cite web |url=http://crossbar.io/docs/Architecture |title=Crossbar node architecture |access-date=2015-04-20 |archive-date=2015-01-12 |archive-url=https://web.archive.org/web/20150112133407/http://crossbar.io/docs/Architecture/ |url-status=dead }}</ref>
==Implementations==
Line 35 ⟶ 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="
|-
! 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#]]
|-
|
|
|-
| 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===
Since the router is a moving part, it is best used{{According to whom|date=November 2015}} as a swappable black box just like one would consider [[Apache HTTP Server|Apache]] or [[Nginx]] for [[Hypertext Transfer Protocol|HTTP]]:
{| 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>[https://wamp-proto.org/spec.html WAMP 2 specification menu]</ref> which introduced routed RPC. As of now, all routers are compatible with version 2. Some clients remain unported: Wamp.io, AutobahnAndroid, and cljWAMP.
The version 2 of the specification is divided into two parts: the basic profile, including the router RPC and Pub/Sub, and the advanced profile, featuring trust levels, URI pattern matching, and client listing. The basic profile is considered stable and is what current libraries are implementing while the advanced profile is still in evolution.
==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).
* '''Routed RPC''': supports routed (not only point-to-point) Remote Procedure Calls.
* '''Web native''': runs natively on the Web (without tunneling or bridging).
* '''Cross Language''': works on and between different programming languages and run-times.
* '''Open Standard''': Is an open, official specification implemented by different vendors.
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]].
* Multi-media streaming like [[WebRTC]].
* Large file transfer like HTTP.
Nevertheless, numerous protocols share some characteristics with WAMP:
{| class="wikitable sortable"
! Technology
! PubSub
! RPC
! Routed RPC
! Web native
! Cross Language
! Open Standard
|-
| WAMP
| {{ya}}
| {{ya}}
| {{ya}}
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[Ajax (programming)|AJAX]]
|
| {{ya}}
|
| {{ya}}
| {{ya}}
|
|-
| [[AMQP]]
| {{ya}}
| {{ya}}
|
|
| {{ya}}
| {{ya}}
|-
| Apache Thrift
|
| {{ya}}
|
|
| {{ya}}
|
|-
| Capn'n'Proto
|
| {{ya}}
|
|
| {{ya}}
|
|-
| [[Comet (programming)|Comet]]
|
|
|
| {{ya}}
| {{ya}}
|
|-
| [[Data Distribution Service|OMG DDS]]
| {{ya}}
|
|
|
| {{ya}}
| {{ya}}
|-
| [[D-Bus]]
|
|
|
|
| {{ya}}
|
|-
| CORBA
| {{ya}}
| {{ya}}
|
|
| {{ya}}
| {{ya}}
|-
| [[Distributed Component Object Model|DCOM]]
| {{ya}}
| {{ya}}
|
|
| {{ya}}
|
|-
| [[Java Message Service|Java JMS]]
| {{ya}}
|
|
|
|
| {{ya}}
|-
| [[Java remote method invocation|Java RMI]]
|
| {{ya}}
|
|
|
| {{ya}}
|-
| [[JSON-RPC]]
|
| {{ya}}
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[MQTT]]
| {{ya}}
|
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[Representational state transfer|REST]]
|
| {{ya}}
|
| {{ya}}
| {{ya}}
|
|-
| SOAP
|
| {{ya}}
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[Socket.io]]
| {{ya}}
|
|
| {{ya}}
|
|
|-
| SockJS
|
|
|
| {{ya}}
| {{ya}}
|
|-
| [[Streaming Text Oriented Messaging Protocol|STOMP]]
| {{ya}}
|
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[XML-RPC]]
|
| {{ya}}
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[XMPP]]
| {{ya}}
| {{ya}}
|
| {{ya}}
| {{ya}}
| {{ya}}
|-
| [[ZeroMQ]]
| {{ya}}
|
|
|
| {{ya}}
|
|-
| [[Distributed Data Protocol|DDP]]<ref>[https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md DDP specs]</ref>
| {{ya}}
| {{ya}}
|
| {{ya}}
| {{ya}}
|
|}
Although, it is important to note that while DDP does Pub/Sub under the hood to synchronize data sets, it does not expose PubSub primitives. It also is an open specification with several implementations, but not registered as a standard.
==References==
Line 147 ⟶ 410:
[[Category:Remote procedure call]]
[[Category:Data serialization formats]]
[[Category:Inter-process communication]]
[[Category:Message-oriented middleware]]
[[Category:Middleware]]
[[Category:Internet protocols]]
[[Category:Network protocols]]
[[Category:Open standards]]
|