init function

The init function instansiate a new WebSocket object and sets up listeners for it's events.