ArticleslgStudy

computer science

Web Application Messaging Protocol

Web Application Messaging Protocol is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Web Application Messaging Protocol rather than just read about it. In short: WAMP is a WebSocket subprotocol registered at IANA, specified to offer routed RPC and PubSub. Its design goal is to provide an open standard for soft, real-time message exchange between application components and ease the creation of loosely coupled architectures based on microservices.

Key takeaways

  • Web Application Messaging Protocol belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Web Application Messaging Protocol to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Web Application Messaging Protocol from memory before moving on to harder problems.

Reference excerpt

WAMP is a WebSocket subprotocol registered at IANA, specified to offer routed RPC and PubSub. Its design goal is to provide an open 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), fit for developing responsive web applications or coordinating multiple connected IoT devices.

Characteristics

Structure WAMP requires 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, Unix sockets, or HTTP long poll. Message serialization assumes 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.

Workflow WAMP is architectured around client–client communications with a central software, the router, dispatching messages between them. The typical data exchange workflow is:

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. 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 TLS for encryption. Even when full confidentiality is not established, several mechanisms are implemented to isolate components and avoid man-in-the-middle attacks. 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 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 TLS certificate, 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 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.

Implementations

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):

The minimum requirements to build a WAMP client are the abilities to use sockets and to serialise to JSON. Thus, many modern languages already fulfill these requirements with their standard library. Additional features which would add dependencies, such as TLS encryptions or MessagePack serialization, are optional. However, the persistent nature of WebSocket connections requires the use of non-blocking libraries and asynchronous APIs. 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 WSGI, a synchronous API, and running a WAMP client inside a WSGI worker needs manual adapters such as crochet.

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. Since the router is a moving part, it is best used as a swappable black box just like one would consider Apache or Nginx for HTTP:

Tavendo, the company from which originated the protocol, is also the author of Crossbar.io, which promotes itself as the de facto router implementation. As they are promoting microservice-based architectures, Crossbar.io embeds a service manager for hosting and monitoring WAMP app components, a static file Web server, and a WSGI container. Being written with the Twisted library, it is one of the implementations that can be set up in production without a proxy, aiming to replace stacks such as Nginx associated with Supervisor and Gunicorn.

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Web Application Messaging Protocol

Start with the simplest possible case. Write down what Web Application Messaging Protocol claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Web Application Messaging Protocol before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Web Application Messaging Protocol ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Web Application Messaging Protocol

In research
Web Application Messaging Protocol appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Web Application Messaging Protocol in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Web Application Messaging Protocol is common in secondary-school and first-year university syllabi. It links to neighbouring topics Application layer protocols, Data serialization formats, Inter-process communication, so understanding it makes those chapters shorter.
In everyday life
Look for Web Application Messaging Protocol outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Web Application Messaging Protocol” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Web Application Messaging Protocol in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Web Application Messaging Protocol means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Web Application Messaging Protocol out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Web Application Messaging Protocol in simple terms?

WAMP is a WebSocket subprotocol registered at IANA, specified to offer routed RPC and PubSub. Its design goal is to provide an open standard for soft, real-time message exchange between application components and ease the creation of loosely coupled architectures based on microservices.

Why does Web Application Messaging Protocol matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Web Application Messaging Protocol?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Web Application Messaging Protocol.

Tags

  • Application layer protocols
  • Data serialization formats
  • Inter-process communication
  • Internet protocols
  • JSON
  • Message-oriented middleware
  • Middleware
  • Network protocols
  • Open standards
  • Remote procedure call

Keep exploring