Streams

Am using express I want to read a file using readStream in express and send to the frontend each time a buffer is ready...I want to know how to get the data on the frontend for each buffer, not waiting till all is fetched and combined into one response, it's music data with each response can I add to audio src html type to create some sort of streaming experience, is this possible? A good resources (video preferably) would be nice I've searched
7 Replies
b1mind
b1mind2y ago
You are probably going to want some sort of websockets
Electronic
ElectronicOP2y ago
🥲 🥲...If I connect a web socket from client to server does it affect async nature of node...I haven't really used websockets before 😩
b1mind
b1mind2y ago
Right but if you want data to update the front that is really going to be the way otherwise the user need to initiate the request well not right idk actually what you mean hah websockets should not mess with your aysnc code 🤷‍♂️
Electronic
ElectronicOP2y ago
Okay thanks...to be more specific, what I mean is something like SoundCloud or YouTube as your listening more is sent and buffered, that's web Sockets too?
b1mind
b1mind2y ago
not sure honestly. Streaming is costly and a pain so I've have not* gotten into it recently. Back when I did do FLV video player, I just had it queued into the player, it handled the rest so 🤷‍♂️ I am going to assume it all uses web sockets though now
Electronic
ElectronicOP2y ago
Oo thanks, I've been tryna just get my pieces of skills right...and streams just felt like the direction to go I'll focus on that now
Want results from more Discord servers?
Add your server