Socket cleanup to reduce memory usage and example client script firefox issue solved