emschwartz / ilp-protocol-paystream

Duplex payment streams over ILP (and PSK)
https://github.com/interledger/rfcs/issues/388
2 stars 2 forks source link

Should there be a pause message and method? #21

Open emschwartz opened 6 years ago

emschwartz commented 6 years ago

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?

sharafian commented 6 years ago

What would be the use case for this? Doesn't the stream already 'pause' when it's in a stable state?

emschwartz commented 6 years ago

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.

sharafian commented 6 years ago

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?

emschwartz commented 6 years ago

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

emschwartz commented 6 years ago

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.

emschwartz commented 6 years ago

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.