iostream is destroyed when socketio disconnected, so move iostream to socketio.connect scope.