Refactor socketmixin