take socket set logic out of jquery