Detect when websocket connection fails

Closes #134