Performance improvement. Messages are not serialized into JSON if there is no connection.