[fix] improved error handling
[other] added some todo comments
[feature] improved connection data and pass the callbacks through it
[feature] added debug logs for various of situations

and improved close event handling