primus/primus — pull request #284 by mariocasciaro (2014-08-26 14:19:52+00:00)
Title: [Sockjs] Handle 1006 error as 'end' event rather than 'error'

When a Websocket connection is suddenly interrupted by a server crash or shutdown, Primus generates an 'error' event rather than a 'close' event. This leaves the Spark in an open state for while, and therefore does not trigger the reconnection algorithm.
SockJS seems outputting this error:
{type: 'close', code: '1006', reason: 'Websocket connection broken'}
This patch treats 1006 errors as an 'end' event, thus fixing the issue.