Fix issues #48 - Can not connect to Websocket
Fixes issues #49 - Make sure only do socket.send when connected