Fixing reconnect issue after client disconnects.

Motivation:
The current implementation contains a bug as a client that reconnects is
not added to the list of client listeners for a document. This means
that other clients will get the updates when the client connects, the
same client will not receive new updates on the server.