-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPSP link events (load/error more than once? loadstart/abort?) #239
Comments
Related issue/discussion |
That's correct. That should hopefully be clear in the updated spec... basically, when the
I don't think so (loadstart is for media stuff, I think... and "legacy" XHR)... but happy to discuss.
The load should fire after the JSON is downloaded and parsed... SPSP and STREAM can then retry independently after. |
I was referring to the situation where nothing changes, except that the
extension wants to refresh the SPSP details (for some reason). Yeah, I
figured @href changing would trigger a new load on the same link.
I think the SPSP details refreshing was partly due to privacy issues that
@sharafian can probably speak better to.
I saw that loadstarted was some media / ProgressEvent thing. Is there some
other event key more appropriate for just before initiating spsp request?
Sometimes SPSP details requests can take a while.
SPSP "retrying" can be done independently? (edit: a -> e)
Are you saying without further load or error events??
Not quite following.
If it fails at first, then error emitted, but the retry succeeds and ??
|
Note that downloading the JSON is the only part of SPSP that uses the
payment pointer endpoint. The rest is STREAM setup using the details
encoded in the JSON.
I think am I not understanding you.
|
No problem. Let's try this again The only part the spec is currently concerned about:
Once SPSP/STREAM take over, no more "load" or "error" events are fired at the link. Only "monetization" events are fired. Hope that makes more sense. |
Right, but what about retries/reconnects ?
Just use the same SPSP connection details for the life of the page ?
|
These shouldn’t be observable by the web page.
Yes. The assumption being that JSON details found initially are governing what’s happening with respect to WM. However, if there is an unrecoverable error that happens at the STREAM layer, and the only mitigation/recovery strategy would be for the developer to provide a new payment pointer, then we should consider firing an error. When speaking to @AlexLakatos, we didn’t come up with such a scenario - but maybe we missed something? When could such a situation occur with STREAM? |
I guess my concern is it needs to work, not just be an elegant design and that we likely do things for reasons. We retry now cause it provides a better experience in the face of dodgy network and temporary/sporadic service outages etc.
Firstly, I was not around for the development of ILP or WM. I was at ripple for a stint before (2013-2016 ish), but didn't really have much to do with ILP. Secondly, I joined Coil when they'd already developed WM. All that to say I'm a bit foggy on why some things are done the way they are. However, there was some discussion on this over at the issue I linked ( #149) See in particular Ben's (@sharafian)comment: You could just say that's a Coil implementation concern and it sure makes things simpler/easier to just have one load/error event per "new" link. Actually, you are proposing in your final comment a situation where it could fire a As said before, I'm not really familiar with ILP in depth, but I imagine that it's possible that there could be stateful/expiring implementations of SPSP, such that the addresses/secrets don't work forever. Or maybe someone updated their payment pointer to point to some other address? (edit: I'm definitely foggy on how that works, so big grain of salt) Shouldn't the SPSP server's cache headers be respected ? Sorry if I sound confused, trying to muddle my way through this :) |
Also, I wonder about the receipt nonces If we use the same receipt nonce for more than one STREAM connection (as would be in the case of this new model where we don't re-request SPSP details before each STREAM connection ? ) could that cause some havoc with balance tracking ? @wilsonianb @sharafian https://github.com/interledgerjs/ilp-protocol-stream/blob/master/src/server.ts#L164 |
To clarify on the previous comment:
It seems it's in the name: |
Yeah, I think it would be problematic to try to re-use the same nonce + stream id for receipts. fwiw the SPSP spec says:
and the STREAM spec:
Assuming stream id's reset on reconnections, maybe the client could fast forward to an unused stream id without violating protocol? |
@wilsonianb wrote:
Yes, that would be bad. Definitely don't want to do that. Sorry, I think we are accidentally talking past each other - but the info about how SPSP and STREAM work is really helpful. Let's see if we can get a shared understanding. The new spec doesn't seek to modify or change the way SPSP or STREAM works. Instead, it's only concerned that: <link
rel="monetization"
href="https://example.com/spsp.json"
onload="SPSP_JSON_Loaded()"
onerror="SPSP_or_STREAM_Error()"
> The The However, if one of the refreshes errors ( Thoughts? |
So here's the cases for doing more than one SPSP request per unique href
I think transparency about what's happening isn't necessarily a bad thing? And use cases tend to take care of them selves. It doesn't seem like we are going to be able to present a nice simple one load OR one error programming model, like is probably the case with say an (edit: hit send accidentally before finishing this, so bear with me) |
I'm wondering if a |
I think I'm getting confused and forgetting we are trying to move away from exposing protocol specific state in the API. The link is just a "link" to an SPSP document. It happens to emit monetization events but those are supposed to be from anywhere, right? |
Just being clear: after the first "load", SPSP can do as many request on itself as it likes. Just "load" should only fire for the first one.
Ok, so... that generally that's not how we do add stuff to web APIs: Everything should have a very clear use case or reason for being there. I understand that "use cases tend to take care of them selves", but those are usually in the form of privacy and security attacks. We should be looking at exposing as little as humanly possible to meet well defined use cases.
One us is confused 😝 But what you describe above is the goal: one single "load" and/or a single "error". I think that's what we have. We might need to have a call tho, as we might be going in circles.
I'm not seeing any semantic violation. I think maybe you are be overthinking this? (or I'm not getting something obvious!). But - our goal is the same: one "load" event. And, if needed, one "error" event. |
You can understand my confusion going from the above to below lol
So these are events are more like an initial SPSP validation phase ? Actually when you mention WM Agent, it's still not clear how that's going to be architected, and what information is shared. Will they have access to the payment pointer to request SPSP again, or will they have some kind of refresh mechanism (as per Sid's version) ? |
Fair enough. What is the load event for ? |
for developers, it answers: "is web monetization supported? Can I maybe expect 'monetization' events?" so, for example: <script>
// only set up listeners if it loads...
function setupListeners(target) {
const elem = target.closest(".monetizable")
elem?.addEventListaner("monetization", makeMeMoney);
}
</script>
<article class="monetizable">
<link rel="monetization" onload="setupListeners(this)">
</article>
I think the "load" case above is still valid. |
Can we open an issue to discuss WM Provider configuration/implementation ? Does that need to be specified ? |
If you feel it will have an impact on the shape of the current spec, then absolutely!
We can definitely talk about it (or include a note or something)... is this similar to #133? |
Would that only answer that question while WM is in its infancy (impl by Coil extension for example ) ?
Yeah, #133 I see @AlexLakatos' model (recent comment from December 3rd ish) is a bit different to Sids, though they both rely upon extensions, rather than some web protocol. Sid's model might be an easier sell in terms of impl burden for browsers. I wonder also if there is more flexibility if the provider has complete control of the STREAMs and where they are initiated from (maybe not even in the browser) Another consideration is that STREAM doesn't have a hard dependency on BTP (that I know of), yet in this model it would. |
So I was adding in the routing of SPSP events in the morning and recalled that we retry (*) on 5xx and abort on 4xx
At least in the extension now, if the STREAM gets broken (say due to bad net) then the SPSP will be reloaded before reconnecting.
So with the extension now a link tag could emit events for more than one of: load and/or error
Also, would loadstart / abort events be suitable here ?
main
(and the extension that is currently published) we actually just keep retrying, albeit with a 2 second delay.The text was updated successfully, but these errors were encountered: