webworker socket functions