change connect event to emit socket