binaryjs / binaryjs

Node binary websocket streaming made easy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

BinaryJS Server Response to Indivual Client

opened this issue · comments

This is my abbreviated code to receive audio stream from clients:
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 to store audio in buffers)});

stream.on('end', function() {
  //end of stream
  //(routine that calls an addon and convert speech to text)
  //****Immediate response to client******
});

});
});

Now, my objective is to send immediately a response (to client) when its generated in the routine "speech-to-text". I am trying to do this with BinaryJS but I cant understand how.