added "onopen" event handler

Trying to fire an event before the WS connection was established caused an error (see issue #3 )
This commit adds a wrapper event around the native websockets "onopen" to ensure that the connection is actually open before firing anything