`'\(space\) or
\t` (tab). Multiple whitespace characters will be treated as a single field delimiter.CR
followed by LF
(CR+LF
, \r
, 0x0D0A
) to terminate protocol messages. This newline sequence is also used to mark the beginning of the actual message payload in a RMSG
protocol message.SUB foo 1\r
and sub foo 1\r
are equivalent.INFO
message. The accepting server will add an ip
field containing the address and port of the connecting server, and forward the new server's INFO
message to all servers it is routed to.INFO
message with an ip
field will attempt to connect to the server at that address, unless already connected. This propagation of INFO
messages on behalf of a connecting server provides automatic discovery of new servers joining a cluster.INFO {["option_name":option_value],...}
server_id
: The unique identifier of the NATS serverversion
: The version of the NATS servergo
: The version of golang the NATS server was built withhost
: The host specified in the cluster parameter/optionsport
: The port number specified in the cluster parameter/optionsauth_required
: If this is set, then the server should try to authenticate upon connect.tls_required
: If this is set, then the server must authenticate using TLS.max_payload
: Maximum payload size that the server will accept.connect_urls
: A list of server urls that a client can connect to.ip
: Optional route connection address of a server, nats-route://<hostname>:<port>
INFO
string received by a NATS server, with the ip
field.CONNECT
message is analogous to the INFO
message. Once the NATS server has established a TCP/IP socket connection with another server, and an INFO
message has been received, the server will send a CONNECT
message to provide more information about the current connection as well as security information.CONNECT {["option_name":option_value],...}
tls_required
: Indicates whether the server requires an SSL connection.auth_token
: Authorization tokenuser
: Connection username (if auth_required
is set)pass
: Connection password (if auth_required
is set)name
: Generated Server Namelang
: The implementation language of the server (go).version
: The version of the server.CONNECT {"tls_required":false,"name":"wt0vffeQyoDGMVBC2aKX0b"}\r
RS+
initiates a subscription to a subject on on a given account, optionally with a distributed queue group name and weighting factor. Note that queue subscriptions will use RS+ for increases and descreases to queue weight except when the weighting factor is 0.RS+ <account> <subject>\r
RS+ <account> <subject> <queue> <weight>\r
account
: The account associated with the subject interestsubject
: The subjectqueue
: Optional queue group nameweight
: Optional queue group weight representing how much interest/subscribersRS-
unsubcribes from the specified subject on the given account. It is sent by a server when it no longer has interest in a given subject.RS- <account> <subject>\r
account
: The account associated with the subject interestsubject
: The subjectRMSG
protocol message delivers a message to another server.RMSG <account> <subject> [reply-to] <#bytes>\r\n[payload]\r
account
: The account associated with the subject interestsubject
: Subject name this message was received onreply-to
: The optional reply subject#bytes
: Size of the payload in bytespayload
: The message payload dataPING
and PONG
implement a simple keep-alive mechanism between servers. Once two servers establish a connection with each other, the NATS server will continuously send PING
messages to other servers at a configurable interval. If another server fails to respond with a PONG
message within the configured response interval, the server will terminate its connection. If your connection stays idle for too long, it is cut off.PING\r
PONG\r
-ERR
message is used by the server to indicate a protocol, authorization, or other runtime connection error to another server. Most of these errors result in the remote server closing the connection.