thalmiclabs / myo.js

Myo javascript bindings
Apache License 2.0
198 stars 63 forks source link

npm module myo.js crash due to ws@0.4.32, suggest to upgrade it to ws@1.1.1 #25

Closed JoshuaJi closed 7 years ago

JoshuaJi commented 7 years ago

In the npm module, myo.js uses ws@0.4.32 by default, however it crashes after running several seconds.

Error message:

SyntaxError: Unexpected end of JSON input
    at Object.parse (native)
    at WebSocket.handleMessage (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/myo/myo.js:60:20)
    at WebSocket.onMessage (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/WebSocket.js:355:18)
    at emitTwo (events.js:106:13)
    at WebSocket.emit (events.js:191:7)
    at Receiver.self._receiver.ontext (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/WebSocket.js:682:10)
    at Receiver.finish (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/Receiver.js:391:14)
    at Receiver.expectHandler (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/Receiver.js:378:31)
    at Receiver.add (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/Receiver.js:87:24)
    at Socket.firstHandler (/Users/xuji/Desktop/home_automation/myo_control_client/node_modules/ws/lib/WebSocket.js:663:22)

After googling, I found out ws@0.4.32 will crash with node@6.2.0 and above. Thus, I upgraded ws in myo module, and it never crashed ever since.

Please use ws@1.1.1 as default in npm module if possible. Thanks!

JoshuaJi commented 7 years ago

ws is updated to 1.1.1 in the latest version, I can close this issue now. Thanks!