QoS - Levels
As mentioned above each message can have a level set. By default the level is set to 0.
- 0 (Fire and forget)
- 1 (At least once)
- 2 (Exactly once) - not implemented in XSockets 5.0.3.
Level 0
just means that the message will be sent the way it has always been done in XSockets. You will not get a acknowledgment
about the message being received
at the client/server.
Level 1
means that the sender
(client/server) will set an ID on the message, and then store the message locally to be re-sent in the future if there was no acknowledgment
from the client/server.
The receiver
(client/server) will respond with an acknowledgment so that the sender (client/server) can release the message from the local storage.
The sender will re-send
the message
until the acknowledgment
is received
The flow for QoS - Level 1
can be described as shown below.
- The sender sets the QoS to 1 and also generates an ID for the message
- The sender stores the message to be re-sent if no acknowledgment is received
- The sender re-send the message with an configurable interval until the message is acknowledged
- The receiver send back a messages-acknowledgment for the message
- The sender removes the message with the same ID as the message acknowledged
Note: Sender can be server/client, receiver can be server/client