It would probably also make more sense if I were to add some kind of buffering or storage in the future.
People could then use netcat to send and receive, and the server could block either end until someone connects on the other end. Personally I would really appreciate a tool I could connect to with netcat or anything else that speaks TCP. I don’t know how someone would use the service from javascript though.
No buffering needed by the server. If either end has to be asynchronous, just run in background + nohup if you’re calling this from a shell.
Maybe some inspiration from how blocking FIFOs work on Linux: http://man7.org/linux/man-pages/man7/fifo.7.html
You could even do a non-blocking version which just refuses connection. netcat can be set to retry: https://unix.stackexchange.com/questions/432249/nc-to-retry-...
I realise that this doesn’t make it easy to indicate which pipe one wants to connect to.
Edit: One nice thing about the https interface is that you get an encrypted channel. Maybe SSH would be another option for transport. That would also make passing keys easier.