The "tcp" transport is an implementation of Salt's channels using raw tcp sockets. Since this isn't using a pre-defined messaging library we will describe the wire protocol, message semantics, etc. in this document.
This implementation over TCP focuses on flexibility over absolute efficiency. This means we are okay to spend a couple of bytes of wire space for flexibility in the future. That being said, the wire framing is quite efficient and looks like:
msgpack({'head': SOMEHEADER, 'body': SOMEBODY})
Since msgpack is an iterably parsed serialization, we can simply write the serialized payload to the wire. Within that payload we have two items "head" and "body". Head contains header information (such as "message id"). The Body contains the actual message that we are sending. With this flexible wire protocol we can implement any message semantics that we'd like-- including multiplexed message passing on a single socket.
The current implementation uses the same crypto as the zeromq
transport.
For the pub channel we send messages without "message ids" which the remote end interprets as a one-way send.
注解
As of today we send all publishes to all minions and rely on minion-side filtering.
For the req channel we send messages with a "message id". This "message id" allows us to multiplex messages across the socket.