I use the spawn function from node's child process module to start mpv player and then communicate through a unix socket with it.
My problem is, that when spawning mpv it is not yet ready and right away. I'd like something like a callback or a promise to see when the mpv process is ready.
spawn('mpv', arguments, function() {
// mpv ready
});
I though about using a promise by "pinging" the socket and resolve it, when it is successful. But I'm not very familiar with promises yet.
Does anybody happen to have some experience with that?
I dont know, why you want to do this in promise way, you can do some code when you recive some data in data handler..
I think, you can try with promise in this way