Content deleted Content added
(35 intermediate revisions by 28 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=
==Characteristics==
Line 7 ⟶ 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
===Workflow===
WAMP is architectured around client–client communications
* Clients connect to the router using a transport, establishing a session.
Line 28 ⟶ 27:
* '''publish''': a client publishes information about this topic.
This can have subtle variations depending
===Security===
Line 34 ⟶ 33:
As WAMP uses Websocket, connections can be wrapped in [[Transport Layer Security|TLS]] for encryption. Even when full [[confidentiality]] is not established, several mechanisms are implemented to isolate components and avoid [[man-in-the-middle attack]]s. Default implementations ensure that trying to register an already registered procedure will fail.
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
Some realms can
===Routed RPCs===
Line 42 ⟶ 41:
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>
==Implementations==
Line 59 ⟶ 58:
! Language
|-
|
| [[JavaScript]] for the [[AngularJS]] framework
|-
|
| [[C++]] 11
|-
| wamplv
| [[LabVIEW]] (G)
|-▼
| AutobahnJS
| JavaScript ([[Web browser|browser]] and [[Node.js]])
|-
|
| [[Python (programming language)|Python]]
|-
| wampy
| [[Python (programming language)|Python]]
|-
| Net::WAMP
| [[Perl]]
|-▼
| backbone.WAMP
| JavaScript for the [[Backbone.js]] library
|-
|
| C++ 11
|-
| Erwa
| [[Erlang (programming language)|Erlang]]
|-
| Jawampa
| [[Java (programming language)|Java]]
|-
| [|
| [[Lua (programming language)|Lua]]
|-
| MDWamp
| [[Objective-C]]
|-
| Minion
| [[PHP]]
|-
| rx.wamp
| JavaScript for the [[React (JavaScript library)|React]] library
|-
|
| PHP
|-
|
| C++
|-
| wampcc
| C++
|-
| WampSharp
| [[C Sharp (programming language)|C#]]
|-
|
| JavaScript (browser only)
|-
| nexus
| [[Go (programming language)|Go]]
|}
Line 115 ⟶ 126:
However, the persistent nature of WebSocket connections requires the use of non-blocking libraries and [[Asynchronous I/O|asynchronous]] [[Application programming interface|API]]s. In languages with one official mechanism such as JavaScript, Erlang or Go, this is not an issue. But for languages with several competing solutions for asynchronous programming, such as Python or PHP, it forces the client author to commit to a specific part of the ecosystem.
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 client inside a WSGI worker needs manual adapters such as
===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>
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]]:
Line 128 ⟶ 139:
! Language
|-
| Bondy
| [[Erlang (programming language)|Erlang]]
|-
| Crossbar.io
| Python (CPython and [[PyPy]])
|-
| Erwa
| Erlang
|-
| wampcc
| C++
|-
| Jawampa
| Java
|-
|
| PHP
|-
| wamp.rt
| JavaScript (Node.js only)
|-
|
| C#
|-
| Wiola
| [[Lua (programming language)|Lua]]
|-
|
| JavaScript (Node.js only)
|-
| 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 WebSocket sub-protocol, WAMP fits naturally anywhere one would use raw web sockets, as a way to synchronize clients such as Web browsers, push notifications to them and allow soft real-time collaboration between users.<ref>[https://github.com/voryx/angular-wamp WAMP and AngularJS]</ref> It has also the same limitations, requiring client support, which is missing for [[Internet Explorer]] versions older than 10.<ref>{{cite web|url=http://caniuse.com/#feat=websockets|title=Can is use websockets ?}}</ref> This is mitigated by the existence of [[Polyfill (programming)|polyfill]]s<ref>[https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills Web socket polyfills]</ref> using more portable technologies such as [[Adobe Flash|Flash]] or the use of HTTP Longpoll as a fallback. In that sense, WAMP is a competitor to [[Meteor (web framework)|Meteor]]'s [[Distributed Data Protocol|DDP]].
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 JavaScript).
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>[
* '''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 181 ⟶ 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 229 ⟶ 247:
|
|-
|
|
| {{ya}}
Line 301 ⟶ 319:
| {{ya}}
|-
| [[MQTT]]
| {{ya}}
|
|
| {{ya}}
▲|
| {{ya}}
| {{ya}}
Line 333 ⟶ 351:
|
|-
|
|
|
Line 359 ⟶ 377:
| [[XMPP]]
| {{ya}}
| {{ya}}
▲|
|
| {{ya}}
Line 373 ⟶ 391:
|
|-
| [[Distributed Data Protocol|DDP]]<ref>[https://github.com/meteor/meteor/blob/devel/packages/ddp/DDP.md
| {{ya}}
| {{ya}}
Line 382 ⟶ 400:
|}
Although, it is important to note that while DDP does
==References==
|