refactor socket servers