I'm using binaryjs to implement a video transfer program between node.js server and node-webkit client.The client stays connected,once a video is uploaded,the client starts downloading it.
It works fine generally,the client does get the videos.But the client throws an error and crashes when the server restarts or crashes. I have been listening the BinaryClient 'error' & 'close' event,however it doesnot works.
I guess maybe i'd listen 'error' event from something else.What to do to fix the problem?Anyone can help?
Thanks a lot!
app.js:
var BinaryServer = require('binaryjs').BinaryServer;
var server = http.createServer(app).listen(3000);
var binaryServer = new BinaryServer({ server: server, path: '/binary' });
binaryServer.on('connection', function (client) {
// client on stream
// client on close
// client on error
});
// binaryServer on error
client:
var BinaryClient = require('binaryjs').BinaryClient;
var binaryClient = new BinaryClient('ws://127.0.0.1:3000/binary');
binaryClient.on('open', function () {
// binaryClient.createStream( ... )
});
// binaryClient on stream
// binaryClient on close
// binaryClient on error
error:
Uncaught node.js Error
Error: read ECONNRESET
at exports._errnoException (util.js:742:11)
at TCP.onread (net.js:541:26)
via Alex Zhong
No comments:
Post a Comment