Web Application Messaging Protocol: Difference between revisions

Content deleted Content added
mNo edit summary
 
(7 intermediate revisions by 7 users not shown)
Line 2:
{{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 to coordinatecoordinating multiple connected IoT devices in the [[Internet of Things|IoT]].<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 8:
===Structure===
 
WAMP requires<ref>[{{Cite web |url=http://crossbar.io/docs/Router-Transports/ |title=Crossbar.io router transport ]|access-date=2015-01-12 |archive-date=2015-01-12 |archive-url=https://web.archive.org/web/20150112101645/http://crossbar.io/docs/Router-Transports/ |url-status=dead }}</ref> a reliable, ordered, [[full-duplex]] message channel as a [[transport layer]], and by default uses Websocket. However, implementations can use other transports matching these characteristics and communicate with WAMP over e.g. raw sockets,<ref>{{cite web|url=https://github.com/tavendo/WAMP/issues/63|title=WAMP can run over Raw transports instead of WebSocket. Each message is prefixed with a uint32 (big endian) that provides the (serialized) length of the following WAMP message.|website=[[GitHub]] }}</ref> [[Unix ___domain socket|Unix sockets]], or [[Push technology#Long polling|HTTP long poll]].
 
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, but 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===
Line 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.
Line 58:
! Language
|-
| [https://github.com/voryx/angular-wamp AngularWAMP]
| [[JavaScript]] for the [[AngularJS]] framework
|-
| [https://github.com/tavendo/AutobahnCpp AutobahnCpp]
| [[C++]] 11
|-
| wamplv
| [https://github.com/samangh/wamplv wamplv]
| [[LabVIEW]] (G)
|-
| [https://github.com/crossbario/autobahn-js AutobahnJS]
| JavaScript ([[Web browser|browser]] and [[Node.js]])
|-
| [https://github.com/crossbario/autobahn-python AutobahnPython]
| [[Python (programming language)|Python]]
|-
| wampy
| [https://github.com/noisyboiler/wampy/ wampy]
| [[Python (programming language)|Python]]
|-
| [https://metacpan.org/pod/Net::WAMP Net::WAMP]
| [[Perl]]
|-
| [https://github.com/darrrk/backbone.wamp backbone.WAMP]
| JavaScript for the [[Backbone.js]] library
|-
| [https://github.com/ecorm/cppwamp CppWAMP]
| C++ 11
|-
| Erwa
| [https://github.com/bwegh/erwa Erwa]
| [[Erlang (programming language)|Erlang]]
|-
| Jawampa
| [https://github.com/Matthias247/jawampa Jawampa]
| [[Java (programming language)|Java]]
|-
| [| [https://github.com/KSDaemon/Loowy Loowy]
| [[Lua (programming language)|Lua]]
|-
| MDWamp
| [https://github.com/mogui/MDWamp MDWamp]
| [[Objective-C]]
|-
| Minion
| [https://github.com/Vinelab/minion Minion]
| [[PHP]]
|-
| rx.wamp
| [https://github.com/paulpdaniels/rx.wamp rx.wamp]
| JavaScript for the [[React (JavaScript library)|React]] library
|-
| [https://github.com/voryx/Thruway Thruway]
| PHP
|-
| [https://github.com/rafzi/WAMP_POCO WAMP POCO]
| C++
|-
| wampcc
| [https://github.com/darrenjs/wampcc wampcc]
| C++
|-
| [https://github.com/Code-Sharp/WampSharp WampSharp]
| [[C Sharp (programming language)|C#]]
|-
| [https://github.com/KSDaemon/wampy.js Wampy.js]
| JavaScript (browser only)
|-
| nexus
| [https://github.com/gammazero/nexus nexus]
| [[Go (programming language)|Go]]
|}
Line 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 [https://pypi.python.org/pypi/crochet crochet].
 
===Routers===
Line 139:
! Language
|-
| [https://docs.getbondy.io Bondy]
| [[Erlang (programming language)|Erlang]]
|-
| [http://crossbar.io Crossbar.io]
| Python (CPython and [[PyPy]])
|-
| Erwa
| [https://github.com/bwegh/erwa Erwa]
| Erlang
|-
| wampcc
| [https://github.com/darrenjs/wampcc wampcc]
| C++
|-
| Jawampa
| [https://github.com/Matthias247/jawampa Jawampa]
| Java
|-
| [https://github.com/voryx/Thruway Thruway]
| PHP
|-
| wamp.rt
| [https://www.npmjs.com/package/wamp.rt wamp.rt]
| JavaScript (Node.js only)
|-
| [https://github.com/Code-Sharp/WampSharp WampSharp]
| C#
|-
| Wiola
| [https://ksdaemon.github.io/wiola/ Wiola]
| [[Lua (programming language)|Lua]]
|-
| [https://github.com/christian-raedel/nightlife-rabbit Nightlife-Rabbit]
| JavaScript (Node.js only)
|-
| nexus
| [https://github.com/gammazero/nexus nexus]
| [[Go (programming language)|Go]]
|}
Line 247:
|
|-
| [https://capnproto.org/ Capn'n'Proto]
|
| {{ya}}
Line 351:
|
|-
| [https://github.com/sockjs SockJS]
|
|