Open emschwartz opened 6 years ago
What would be the use case for this? Doesn't the stream already 'pause' when it's in a stable state?
I was thinking the use case would be something like Cog where you want to communicate that you don't need more money right now but you may request more in a bit, or one where you're requesting money and the other party says "I don't have enough right now but I should have more in a bit". However, at least the first one can be inferred if the amountWanted
is 0 but they haven't closed the socket.
yeah, that's a valid case though where you're in an unstable state but you're waiting to accumulate more money so you can keep sending. Will the current implementation close in that case?
Right now the socket will emit an error if you're requesting money but the other side sends 0. It doesn't closed the socket when it gets an error at the moment but it probably should
I spent far too much time today while working on https://github.com/emschwartz/ilp-protocol-paystream/pull/24 debugging issues related to the sockets not being sure if the other side was going to send more.
We definitely need a way to differentiate between "I'm at the limit, you're not getting any more" and "I'm at the limit but if you hold on there's a chance I'll send you more soon".
Is the second case useful for anything aside from Cog? Trying to figure out if the normal behavior should just be to treat reaching the other person's limit as an error.
One way to handle this would be to add another field to the payment socket data that communicates how much more you're willing to send. If you request money and the other person responds that they're willing to send 0 more, it's an error. If they say some positive number then maybe you'll wait for them to do so.
Should there be a way to call
pause
on the socket, which would let the other party know that we're not going to send or receive any more until the user unpauses the stream?