added connect/disconnect support, with onconnect callback