Add "error" event
Add "connection" and "close" events
Drafting API for pub/sub