move socket logic in a service