refactoring socketio