Updated the snippet to sen messages with 1s interval.