Add guard to prevent repeated messages

The sequential ID number of messages is now stored client side and
checked, hopefully to ensure that repeated and out of order messages are
discarded.