[nanomsg] RFC: TTY/Serial Scalability Protocol Transport

  • From: bnewbold@xxxxxxxxxxxxx
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Thu, 3 Sep 2015 23:59:59 +0000 (UTC)


I'm proposing a new generic serial:// transport for sending nanomsg (SP) messages over {RS-232, RS-485, UART, radio, optical, etc} interfaces. Basically, talking with low-cost/low-power microcontrollers in a non-IP context.

Header/protocol wise, I think the closest existing transport is UDP (not actually implemented in libnanomsg). However, because there is only a single pipe/channel over which multiple message types might be sent, I think the implementation might also have similarities with inproc and tcpmux.

Here is a draft RFC in the form of a github gist:
https://gist.github.com/bnewbold/8fe816a5d70c6cbc9bb3

There was some previous discussion in the Crossroads project of serial transports:
http://comments.gmane.org/gmane.network.crossroads.devel/622

I thought I remembered a ZeroMQ serial transport also when I looked years ago, but I can't find it now.

I've been using this transport in development for about half a year now for data acquisition and control. We've built distributed sensor systems where data streams in from many tiny cheap synchronized sensors over UART into a central Linux node which combines PUB messages into a single stream available over TCP. Inbound REQ/REP requests to the linux node have a per-sensor prefix stripped and are then dispatched to the end node for control and configuration. We have also done low-throughput telemetry and system control over a robust-but-extremely-slow low-frequency radio link.

FWIW, in these contexts over a very narrow pipe it's very important to have "sender-side" filtering of PUB messages. Handling this at the protocol layer seems to be hung up with concerns about reliable message propagation. For now we've been using out-of-band RPC to turn topics on and off at the source, but it would be much nicer to somehow do this as part of the PUB/SUB protocol. Note that with UDP or serial there is no connection context in which to even keep a list of subscribed topics though!

I started trying to implement this transport in libnanomsg a while back, but I didn't really understand how all the state machines worked even for TCP so I gave up. We currently use a python proxy program to translate between TCP (multiple sockets) and this serial transport. I know a tiny bit of golang so I might try to do a reference implementation in mangos, and maybe a limited no-heap Arduino library for basic PUB and REQ functionality.

--bryan

PS, I generally try to lurk in the gitter channel, but I'll be AFK until next Tuesday

Other related posts:

  • » [nanomsg] RFC: TTY/Serial Scalability Protocol Transport - bnewbold