@tum-far/ubii-msg-transport
v0.3.0
Published
Ubii message transport module.
Downloads
11
Readme
ubii-msg-transport
This is the repository for Ubii message transport. It contains everything about how ubii nodes and devices communicate with each other. If you are interested in what they say to each other, visit the ubii-msg-format repository.
Table of Contents
Communication Endpoints
We distinguish between one-way communcation patterns (only the client can open a message exchange) and two-way communication patterns (both sides, the clients and the server can send messages to the other side).
Communication patterns have multiple communication endpoints. There are client and server communication endpoints. Implementations must provide methods for binding and message sending. In addition, two-way communciation implementations must implement ping-pong functionality to provide checks of the connection status across different implementations.
Currently, the dealer-router pattern is relevant for two-way communication and the request-reply pattern is relevant for one-way communication.
ZeroMQ (ZMQ)
We provide communication endpoint implementations using the ZeroMQ library.
Endpoints can send Buffer
objects or strings (strings are transformed into buffers).
Dealer-Router Pattern
The dealer router pattern is implemented as ZMQ connection endpoint. It consists of any number of 'zmqDealer' endpoint objects and a 'zmqRouter' endpoint object. It is a two-way communication pattern, so communication is possible in both directions.
With this pattern, received messages always have an envelope that contains the ID of the sender in addition to the plain payload. This should be taken into account in further implementations or processing of received messages.
Dealers communicate with the router by specifying the host and port. After a dealer has communicated with the router, routers can communicate with dealers by specifing the id of the dealer.
Request-Reply Pattern
The request-reply pattern is implemented.
CLIs
Tests
- Run
npm test
to process all standard tests (no round trip time tests). - Run
npm run-script test-rtt
to process all round trip time tests. - See the Testing section for more details on tests.
Testing
This module uses the AVA test runner. You can add new tests to the test folder. Entry point for the test runner is test.js within the test folder. See the AVA Documentation for more details on how to create new test cases for AVA.