skygear-SDK-JS icon indicating copy to clipboard operation
skygear-SDK-JS copied to clipboard

Add error handling on webSocket.send call

Open rickmak opened this issue 7 years ago • 0 comments

Current pubsub package using websocket without proper error handling, and may crash the program on some condition.

sometime fail to send Socket Message out and got some error:

/usr/src/app/node_modules/websocket/lib/W3CWebSocket.js:111
        throw new Error('cannot call send() while not connected');
        ^

Error: cannot call send() while not connected
    at W3CWebSocket.send (/usr/src/app/node_modules/websocket/lib/W3CWebSocket.js:111:15)
    at /usr/src/app/node_modules/skygear/dist/pubsub.js:111:18
    at arrayEach (/usr/src/app/node_modules/skygear/node_modules/lodash/index.js:1289:13)
    at Function.<anonymous> (/usr/src/app/node_modules/skygear/node_modules/lodash/index.js:3345:13)

this also make the cloud plugin server down…

refs: https://github.com/websockets/ws/issues/337

  • Skygear SDK Date/Version: 0.24.0
  • JS runtime: 0.24.0
  • Skygear Server Date/Version: 0.24.0
  • [ ] Is this a regression?
  • [ ] Attached logs, screenshots

Steps to reproduce

rickmak avatar Jul 14 '17 08:07 rickmak