Boomer said:
The data is somewhat unpredictable and in many case repetitious. There is no
way of knowing the data that is being captured is old or new when using
XMLHttpRequest().
One solution to this is to have a sequence number that is incremented
on each request. The server keeps track of changes in status, and
remembers the current sequence number t, and sends that sequence number
with each request. When the client issues a request it sends the last
sequence number it received u, the server sends any changes in the data
between u and t.
It requires a somewhat complex state machine running on the server, but
the client side is easy enough.
Typically you would put a limit on the age of sequence numbers, if the
client sends one that is too old the server sends a 'keyframe' that
includes all data, allowing the client to reset everything to the
current status.
The system is still poll driven rather than interrupt driven, but
signifcantly reduces the traffic volume. (And it sounds like that is a
goal in your case).
HTH
Sam