nwtgck / piping-server

Infinitely transfer between every device over pure HTTP with pipes or browsers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Variable receivers count

tucksaun opened this issue · comments

Hi there!

Thank you for this nice tool!
I see how it can be handy for connecting decoupled or closed ecosystems.

While I was imagining this tool used to push some webhooks info to CD pipelines I wondered how easy it would be to have a variable number of receivers.
I'm not talking about allowing new receivers once the sender started to send but only allowing new receivers while the sender didn't connect it and then making it send right away in that particular case.
I tried to hack it and it seems this is not quite complicated. would you be open to having a PR to support this?

Actually, after trying to add another feature that could be useful for my use case I figured it would probably make more sense to just merge the two as one: add a no-wait feature for the sender.
By doing so we can have a sender send it as soon as it's ready if this is what is decided, whatever the current receiver count is, allowing not to block waiting for a receiver that is not coming.
what do you think?

if the idea sounds okay to you then I can quickly submit a PR :)

I was thinking about something similar too, setup that mimics publisher/subscriber tech!

  • Sender POSTS ReadableStream
  • Receiver 1 GETS the stream and tries to decode it, if they are lucky to catch all chunks they can decode the data
  • Receiver 2 GETS the stream and tries to do the same thing!

At any point any receiver can join/leave

This way you can have one to many chat with variable number of receivers!