Add error management
Add connect and disconnect events
Fix private open method to public one