Copyright | (c) 2016 Patrik Sandahl |
---|---|
License | MIT |
Maintainer | Patrik Sandahl <patrik.sandahl@gmail.com> |
Stability | experimental |
Portability | portable |
Safe Haskell | None |
Language | Haskell2010 |
Message definitions for the NATS protocol.
- data Message
- = INFO {
- serverId :: !(Maybe ByteString)
- serverVersion :: !(Maybe ByteString)
- goVersion :: !(Maybe ByteString)
- serverHost :: !(Maybe ByteString)
- serverPort :: !(Maybe Int)
- serverAuthRequired :: !(Maybe Bool)
- serverSslRequired :: !(Maybe Bool)
- serverTlsRequired :: !(Maybe Bool)
- serverTlsVerify :: !(Maybe Bool)
- maxPayload :: !(Maybe Int)
- | CONNECT {
- clientVerbose :: !(Maybe Bool)
- clientPedantic :: !(Maybe Bool)
- clientSslRequired :: !(Maybe Bool)
- clientAuthToken :: !(Maybe ByteString)
- clientUser :: !(Maybe ByteString)
- clientPass :: !(Maybe ByteString)
- clientName :: !(Maybe ByteString)
- clientLang :: !(Maybe ByteString)
- clientVersion :: !(Maybe ByteString)
- | MSG !Topic !Sid !(Maybe Topic) !Payload
- | PUB !Topic !(Maybe Topic) !Payload
- | SUB !Topic !(Maybe QueueGroup) !Sid
- | UNSUB !Sid !(Maybe Int)
- | PING
- | PONG
- | OK
- | ERR !ProtocolError
- = INFO {
- data ProtocolError
Documentation
The kind of messages that can be exchanged between the NATS server and a NATS client. Some of the documentation strings are taken from: https://nats.io/documentation/internals/nats-protocol/
INFO | As soon as the server accepts a connection from the client, it will send information about itself and the configuration and security requirements that are necessary for the client to successfully authenticate with the server and exchange messages. |
| |
CONNECT | The CONNECT message is the reply to the Info message. Once the client has established a TCP/IP socket connection with the NATS server, and an Info message has been received from the server, the client may sent a Connect message to the NATS server to provide more information about the current connection as well as security information. |
| |
MSG !Topic !Sid !(Maybe Topic) !Payload | The MSG message carries payload from the server to the client. subject: Subject name this message was received on. sid: The unique alphanumeric subscription ID of the subject. reply-to: The inbox subject on which the publisher is listening for responses. #bytes: Implicit by the length of the payload. payload: The message payload data. |
PUB !Topic !(Maybe Topic) !Payload | The PUB message publishes the message payload to the given subject name. If a reply subject is supplied, it will be delivered to eligible subscribers along with the supplied payload. Payload can be zero size. subject: The destination subject to publish to. reply-to: The reply inbox subject that subscribers can use to send a response back to the publisher/requestor. #bytes: Implicit by the length of payload. payload: The message payload data. |
SUB !Topic !(Maybe QueueGroup) !Sid | The SUB message initiates a subscription to a subject, optionally joining a distributed queue group. subject: The subject name to subscribe to. (Optional) queue group: If specified, the subscriper will join this queue group. sid: A unique alphanumeric SubscriptionId. |
UNSUB !Sid !(Maybe Int) | The UNSUB message unsubscribes the connection from the specified subject, or auto-unsubscribes after the specified number of messages has been received. |
PING | The PING and PONG messages are the keep-alive mechanism between the client and the server. The server will continously send Ping messages to the client. If the client does not reply within time the connection is terminated by the server. |
PONG | |
OK | When the verbose (clientVerbose) option is set to true, the server acknowledges each well-formed prototol message from the client with a +OK message. |
ERR !ProtocolError | The -ERR message is used by the server indicate a protocol, authorization, or other runtime connection error to the client. Most of those errors result in the server closing the connection. InvalidSubject is the exception. |
data ProtocolError Source #
Protocol error enumeration.