Open software2000 opened 7 years ago
Haven't seen that before, but really, it's just a minimal example. You're supposed to make your own.
You should check ws.readyState
(or use some other flag variable, or tear down instantly) in the onFrameAvailable
callback.
It does crashes. Quick workaorund will be to use android-minicap example with some changes such as port number etc, https://github.com/openstf/minicap/tree/master/example
Solution: Just add stream.destroy() to ws.on('close').
ws.on('close', () => { console.info('Lost a client') stream.end() stream.destroy(); })
Hey everyone,
everytime a client leaves the example webpage, app.js crashes.
console output:
` Listening on port 9002 Got a client Lost a client /Users/user/Desktop/ios-minicap-master/example/node_modules/ws/lib/WebSocket.js:219 else throw new Error('not opened'); ^
Error: not opened at WebSocket.send (/Users/user/Desktop/ios-minicap-master/example/node_modules/ws/lib/WebSocket.js:219:16) at Parser.onFrameAvailable (/Users/user/Desktop/ios-minicap-master/example/app.js:43:8) at Parser.parse (/Users/user/Desktop/ios-minicap-master/example/nodemodules/minicap/lib/parser.js:33:34) at Socket.tryParse (/Users/user/Desktop/ios-minicap-master/example/app.js:56:14) at emitNone (events.js:86:13) at Socket.emit (events.js:185:7) at emitReadable (_stream_readable.js:432:10) at emitReadable (_stream_readable.js:426:7) at readableAddChunk (_stream_readable.js:187:13) at Socket.Readable.push (_stream_readable.js:134:10)`