added onAccept for servers and onConnect for clients