nkzawa / socket.io-stream

Stream for Socket.IO
MIT License
612 stars 111 forks source link

Send audio file from node.js server to another node.js server #120

Closed ashtonfernandes closed 5 years ago

ashtonfernandes commented 5 years ago

Hello,

I have two node.js servers. I am trying to send an audio file from one server to another. I am converting the audio file to a stream and then sending it using socket.io-stream to the second server.

In my first server (audio file sender), I have the following code: let stream = ss.createStream(); let inputStream = fs.createReadStream('output.wav') inputStream.pipe(stream); ss(socket).emit('finalAudioFile', stream);

In my second server(audio file receiver), I am having issues receiving the stream. I am actually able to pass an audio stream from the second server(audio file receiver) to the first(audio file sender), after which I need to send an audio file from the first server(audio file sender) to the second(audio file receiver), it's breaking. Basically, I need to be able to send streams back and forth. Can you please assist?