add onConnect callback