pubnub/pubnub-api — Issue #63: Node.js unhandled error
Author: dmilisic
Created: 2012-01-30 07:47:53+00:00
State: open

As we are planing to use pubnub node.js api in production, we have been testing it last week. Over the weekend, the server crashed with the following error:

^^
SyntaxError: Unexpected token ILLEGAL
at Object.parse (native)
at IncomingMessage. (/usr/local/lib/node/.npm/pubnub/3.1.4/package/pubnub.js:110:43)
at IncomingMessage.emit (events.js:81:20)
at HTTPParser.onMessageComplete (http.js:133:23)
at Client.onData [as ondata] (http.js:1471:27)
at Client._onReadable (net.js:677:27)
at IOWatcher.onReadable [as callback] (net.js:177:10)

Who knows what the server returned... it happens, but obviously you shod wrap JSON.parse in try...catch block.

This leads us to the question - **is pubnub node.js api mature enough for production use?**