Looking into mqtt as a means to publish messages to browser clients over websockets.
The data would likely be something like a JSON object, whose fields change values over time. I'd like to send over only those changes, not the whole JSON state with each and every message.
Is there a built-in way in the protocol (or some other workaround) that could allow clients to receive a full state on connection, followed by delta-only messages?
One potential workaround would be keeping the full state on a separate topic with retain
flag set, which we'd subscribe to right after the connection establishment, followed by unsub after message is received. But then we'd still be facing the message ordering problem - there's no guarantee the messages on delta topic are following the last state in expected order. Plus there's an overhead of initially subscribing to 2 topics per interested entity instead of one.