Implement a connect callback - see #760