Reset messagesSent to 0 after a connection is reopened