Introduction of WAMP

 Introduction of WAMP 

Web Application Messaging Protocol (WAMP)

·         WAMP is a high-level messaging routed protocol for distributed applications where the application components are distributed on multiple nodes and communicate with messages.

·         It was a subprotocol of websocket.

·         Provides two messaging patterns: Publish & Subscribe and routed Remote Procedure Calls.

·         It uses WebSocket as default transport, but can be transmitted via any other protocol that allows for ordered, reliable, bi-directional, and message-oriented communications.

The key concept of Wamp

Transport:  a channel that connects to peers. The default transport for Wamp is WebSocket. It can run over other transports as well which supports message-based reliable bi-directional communication.

 Session:  A conversation between two peers that run over a transport.

 Client:  Peers that can have one or more roles.

In the publish-subscribe model, the client can have the following roles:-

                Publisher:  Publish events (including payload) to the topic maintained by the broker.

                Subscriber: Describes the topics and receives the event including the payload.

            In the RPC model clients have the following roles:

            caller: Issue calls to the remote procedure along with the call argument.

callee: executes the procedure to which the calls are issued by the caller and returns the result back to the caller.

Routers: Peers that perform generic call and event routing. In the publish-subscribe model, the Router has the role of a broker.

 Broker:  Act as router and routes messages published to a topic to all Subscribers who subscribe to the topic.

 in the RPC model router has the role of a broker:

 Dealer: Act as a Router and routes RPC call from the caller to the callee and route result from callee to caller.

Application code:  application code run on clients( publisher, subscriber, callee or caller).

 

Figure: WAMP session between client and router, establish over a transport.

 


Figure: WAMP protocols interactions between peers.

 

According to these figures, the Wamp transport used is web socket.  

WAMP sessions are established over web socket transport within the lifetime of web socket transport.

The client (in the publisher role) Runs a WAMP application component that publishes a message to the router. 

The router (in the broker role) runs on the server and routes the message to the subscriber. It decouples the publisher from the subscribers. 

The communication between publisher- broker and broker to publisher happens over a WAMP web web-socket session 

 

Advantages

  • This protocol combines two patterns (Pub-Sub & RPC), allowing it to be used for the entire messaging requirements of an application, reducing technology stack complexity.
  • reduces networking overhead.

Disadvantages

  • Not (yet) an official standard.
  • No higher-level software architectural styles like REST (for now).
  • Requires to deploy an additional component- the WAMP router. This additional component increases the time that takes to exchange messages between components compared to a direct WebSocket connection since all messages have to go through the router.
  • Decoupled microservices are more complex than classic client-server architectures.

======================================================

Post a Comment

0 Comments