Fix Javascript error on startup.

"Cannot call method 'isConnected' of undefined line 92 of main.js"
Fix bug #74.

A read error must be considered a disconnect to avoid infinite loop.