node.js - BinaryJS Server Response -
given example bellow:
binaryserver = binaryserver({port: 9001}); binaryserver.on('connection', function(client) { console.log("new connection"); client.on('stream', function(stream, meta) { console.log('new stream'); strean.on('data', function('data'){ //(code store audio in buffers)}); stream.on('end', function() { //end of stream //(routine calls addon , convert speech text) //****immediate response client****** }); }); });
now, objective send response (to client) when generated. trying binaryjs cant understand how.
server side:
binaryserver = binaryserver({port: 9001}); binaryserver.on('connection', function(client) { console.log("new connection"); client.on('stream', function(stream, meta) { console.log('new stream'); strean.on('data', function('data'){ //(code store audio in buffers)}); stream.on('end', function() { //end of stream //(routine calls addon , convert speech text) //****immediate response client****** stream.write(some_variable);<---just }); }); });
client side:
client.on('open', function() { stream = client.createstream("some meta information); //(some rotines) stream.on('data', function(data){ ///-->recebe resposta stream.write() console.log("resultado: "+data); }); }
);
Comments
Post a Comment