Add support for connection using cookie auth
Also export the new connect/3 function
Modify on_error callback to include the reason.

- Old version - on_error/0 - you could only signal a generic error
- New version - on_error/1 - takes as argument the error reason
    The error reason may be of different type depending on
    connection status - on connection upgrade (http connection
    problems) or on tcp transmission/retransmissions
Variable name typo correction
Merge pull request #3 from ctradu/master

Add support for connecting to ws endpoints requiring prior cookie based authentication