alaingilbert/Turntable-API — pull request #228 by gizmotronic (2013-06-23 20:39:50+00:00)
Title: Improved handling of unexpected disconnects

This change builds on @DubbyTT's previous work, adding an event trigger for the case where a Turntable is down (responding with an 302 error instead of JSON), for a name lookup or other connection issue in whichServer, and for the case where a firewall/proxy issue causes the WebSocket to remain up, but we are nevertheless not seeing valid server responses.

This change also renames the "wserror" event to "error" for two reasons:

1. Is it a WebSocket error, or a whichServer error?
2. It's consistent with the [Events class documentation](http://nodejs.org/api/events.html#events_class_events_eventemitter).

(I'm deliberately not including a compiled version in this request. Please either use a CoffeeScript test harness or compile the source using the project Makefile.)