Websocket Application Messaging Protocol protocol: Https://github.com/wamp-proto/wamp-proto
1. Basic Archives
Introduced:
The WAMP protocol is a communication protocol that can be publish&subscribe and RPC based on WebSocket. It realizes the pub&sub communication pattern similar to the ZEROMQ, and uses this mode for the traditional RPC communication, which is a good way to decouple the direct connection between the communication endpoints.
Basic concepts:
Broker:pub&sub the middleware in communication mode.
Middleware for Caller&callee communication in DEALER:RPC.
Router:router is actually a combination of broker and dealer.
Realm:realm is an activity space in the router, and the communication between the clients takes realm as the active interval.
Client: The communication entity, the message Publisher/subscriber, the interface caller/the provider.
Peer:client or router.
The role played by Role:peer.
Topic:pub&sub theme, expressed in URI format.
The interface address of the PROCEDURE:RPC is also expressed using the URI format.
Communication model:
(This picture of specification shows everything)
Https://github.com/Code-Sharp/WampSharp implements the WebSocket Protocol and the WebSocket application Messaging Protocol (WAMP) Association On.
Characteristics:
- Supports WebSocket RFC6455 and Wamp v1/v2
- Very good to meet the standard
- High-performance asynchronous design
- Easy-to-use API
Client Side
Components
The concept is that the component is the calling and callee of the RPC, or the Publisher and subscriber of the PubSub, and the four roles are components, in which case the code is applied. RPC model
3 characters, Caller
Callee
Dealer
Caller
(caller) Invokes the remote interface using the URL and parameters, Callee
gets the parameters to execute, and returns the result
Callee
First the call is registered to, Dealer
Caller
the call first to Dealer
, the Dealer
call will be Caller
routed to the corresponding Callee
, and then the Callee
result is returned to Caller
.
Caller
And Callee
will run the application code, Dealer
will do rpc generic route.
The RPC model has a two-step process, which registers the program and invokes the program.
Now the problem is, I wrote the RPC program, how to register to router inside it? Is it auto-generated in wampsharp, or do you want to change the configuration file manually?
In fact, are not, are by the components themselves to register, other componets to use their own. The specific operation is similar to the callee program connection crossbar, and then register their own to provide others with the API, and then Caller
connect Router Crossbario Calling program, if the Callee
line is dropped, then it will Caller
not be called. PubSub model
There are 3 characters Publisher
, Subscriber
Broker
Publiser
(publisher) provides a URL and corresponding payload that Subscribers
subscribers can receive information about the publisher. Broker
is to provide a place to publish and subscribe. Similar to the publish-subscribe pattern provided in most of our message queues.
Summarize:
The router introduced by Wamp can seamlessly update the backend interface, and realm allows the backend interface to expose only a subset of functionality to the front end. Pub&sub also makes it easy to multicast messages.
Open source libraries that implement the WebSocket and Wamp protocols Wampsharp