NUT-17: WebSocket state updates #98
No reviewers
Labels
No labels
breaking change
bug
documentation
enhancement
needs discussion
needs implementation
new nut
ready
wallet-only
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo-admin/nuts!98
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ws2"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This is my second take on an optional WebSocket protocol to allow bidirectional messages between clients and mints. WebSockets allow mints to push updates to clients without clients constantly polling them.
The proposal uses ids to keep track of requests, which removed the need to close and open sockets all the time and also allows for multiple request on a single socket connection.
would it make sense to use the JSON-RPC format here?
I don't have strong opinions about this. The format is already very close to the RPC spec so I wouldn't mind. What would be the benefit of adhering to it?
I'd guess mainly existing client libraries for using JSON-RPC rather than having to write your own
I wonder if this should include a standardised endpoint as well? E.g. wss:///v1/ws
ACK d99a6f1
@ -0,0 +87,4 @@**Important:** If the subscription is accepted by the mint, the mint MUST first respond with the *current* state of the subscribed object and continue sending any further updates to it.For example, if the wallet subscribes to a `Proof.Y` of a `Proof` that has not been spent yet, the mint will first respond with a `ProofState` with `state == "UNSPENT"`. If the wallet then spends this `Proof`, the mint would send a `ProofState` with `state == "PENDING"` and then one with `state == "SPENT"`. In total, the mint would send three notifications to the wallet.Is it required that the mint sends 3 notifications. In the event the proof is spent via a swap there isn't really a
PENDINGstate. As signing the outputs either succeeds and inputs are spent or fails and the inputs should not beSPENT. Of course could use thePENDINGwhile the verifying and signing happen just not sure how much benefit that adds?ACK d99a6f1
@ -0,0 +87,4 @@**Important:** If the subscription is accepted by the mint, the mint MUST first respond with the *current* state of the subscribed object and continue sending any further updates to it.For example, if the wallet subscribes to a `Proof.Y` of a `Proof` that has not been spent yet, the mint will first respond with a `ProofState` with `state == "UNSPENT"`. If the wallet then spends this `Proof`, the mint would send a `ProofState` with `state == "PENDING"` and then one with `state == "SPENT"`. In total, the mint would send three notifications to the wallet.Good points, maybe we can relax this condition.
just floating this idea, too little too late but wonder if this is something that would have been of interest; what if the mint spoke nostr REQs and acted just like a nostr relay? would be kinda neat to be able to reuse all the nostr comms libraries we've got to talk to mints
Don't know, maybe it's dumb and the protocol is too different, but was curious.