functionality for connect and disconnect user