VILLASframework
Modular co-simulation framework
nanomsg

The nanomsg node-type uses [libzmq] to exchange messages via the ZMTP protocol. It is similiar to the ZeroMQ node-type.

nanomsg is a socket library that provides several common communication patterns. It aims to make the networking layer fast, scalable, and easy to use. Implemented in C, it works on a wide range of operating systems with no further dependencies.

The nanomsg node-type only implements the publish-subscribe protocol provided by nanomsg.

Prerequisites

This node-type requires libnanomsg (>= 1.0.0).

Implementation

The source code of the node-type is available here: https://git.rwth-aachen.de/acs/public/villas/node/blob/master/lib/nodes/nanomsg.cpp

Configuration

format (string)

The payload format which is used to encode and decode exchanged messages.

publish (string / array of strings: uri)

A single endpoint URI or list of URIs on which this node should listen for subscribers.

subscribe (string / array of strings: uri)

A single endpoint URI or list of URIs pointing to which this node should connect to as a subscriber.

Endpoints

The nanomsg supports several different transport mechanisms which are listed in the following table:

Name URI example Documentation
In-process transport inproc://test nn_inproc(7)
Inter-process transport ipc:///tmp/test.ipc nn_ipc(7)
TCP transport tcp://1.1.1.1:456 nn_tcp(7)
WebSocket transport ws://example.com:8080nn_ws(7)

Example

nodes = {
nanomsg_node = {
type = "nanomsg",
out = {
endpoints = [
"tcp://*:12000", # TCP socket
"ipc:///tmp/test.ipc", # Interprocess communication
"inproc://test" # Inprocess communication
],
}
in = {
endpoints = [
"tcp://127.0.0.1:12000",
"ipc:///tmp/test.ipc",
"inproc://test"
]
}
}
}