Function onConnect
read / write