update socket logic