oortcloud / node-ddp-client

A callback style DDP (Meteor's Distributed Data Protocol) node client.
Other
263 stars 80 forks source link

Uncatched exception "Error(not-opened)" #18

Closed sarfata closed 11 years ago

sarfata commented 11 years ago

In some situation after running for a long time (and I suppose, due to network problems), it is possible that calling a method of DDPClient results in an Error('not opened') being thrown by WebSocket.

This is what the exception looks like:

/usr/local/lib/node_modules/pi-steroid/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175
    else throw new Error('not opened');
               ^
Error: not opened
    at WebSocket.send (/usr/local/lib/node_modules/pi-steroid/node_modules/ddp/node_modules/ws/lib/WebSocket.js:175:16)
    at DDPClient._send (/usr/local/lib/node_modules/pi-steroid/node_modules/ddp/lib/ddp-client.js:77:15)
    at DDPClient.call (/usr/local/lib/node_modules/pi-steroid/node_modules/ddp/lib/ddp-client.js:222:8)

This should be properly catched by DDPClient and transformed into a socket-error event (and a reconnection if automatic reconnection is enabled).