You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Client uses a PUBLISH Packet to send an Application Message to the Server, for distribution to Clients with matching subscriptions.
The Server uses a PUBLISH Packet to send an Application Message to each Client which has a matching subscription. https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718037
Our server implementation uses one thread for each client to receive incoming requests and send out responses. If the request is of type publish message we have to send a message to each client subscribed to this message. How will this be implemented? Should each client thread call the other clients streams to send data? In that case we must protect all sending of data behind a lock that only allow one thread at a time to send the message.
This approach might block a thread while trying to send a message to another client. Not good.
A better approach could be to have a thread safe queue where we can add messages that should be sent and then we can have one or more threads working with sending out information as fast as possible. That queue should then store information about the message and to who it should be sent.
Problem Description
The Client uses a PUBLISH Packet to send an Application Message to the Server, for distribution to Clients with matching subscriptions.
The Server uses a PUBLISH Packet to send an Application Message to each Client which has a matching subscription.
https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718037
The receiver of a PUBLISH Packet MUST respond according to:
QoS 0 | None
QoS 1 | PUBACK Packet
QoS 2 | PUBREC Packet
https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718043
In this first implementation lets focus on handling QoS level 0 only so no response messages has to be sent.
The text was updated successfully, but these errors were encountered: