Batching messages before sending them to the client