-
Notifications
You must be signed in to change notification settings - Fork 632
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
Remove NOTICE relay messages from NIP-01 #1783
base: master
Are you sure you want to change the base?
Conversation
Yes, kill it. |
I disagree that NOTICE is useless. While most Nostr flows are request/response, there are cases where a relay needs to notify a client asynchronously. Payment-based relays could be a good example. If a user’s balance runs out, the relay needs a way to inform them, and NOTICE is the natural choice. CLOSED isn’t meant for this, and NIP-11 is static, not real-time. The issue isn’t that NOTICE has no purpose, but that its use is inconsistent. Instead of removing it, we should refine its definition to make it more reliable. Eliminating it would only make communication between relays and clients harder. IMHO. |
Payment based relays should use CLOSED. |
I agree that a payment-based relay should use CLOSE when there is no remaining balance, but how do notify the client beforehand? I still think we could structure NOTICE without breaking backward compatibility. Ultimately, it would achieve the same purpose you’re proposing, since NOTICE without a homogeneous behavior across relays is not very useful. However, I wouldn’t deprecate it, no doubt. |
Use Notify instead. #901 So we can display your message to the user and they can either pay or remove your relay from their relay list. |
NOTICE is very good for debugging and development and they help me all the time. I still think its messages should be displayed to users directly. Perhaps not in their faces, but somewhere. In any case it's just a way for the relay to tell the developer something or anything. You don't have to use them, apps can ignore them if they wish, but we shouldn't remove them. |
If the goal is to debug, we need to make that clear. And then Relays need to overuse it. Right now we do display them to users in the relay info screen. But it is just a bunch of junk. There is no point in showing any of the current messages to users. |
Also, the messages are way too short/missing details and don't point to the action or request that triggered them. We don't even know which sub the notice is referring to. |
For instance, many relays send "error: too fast, slow down please" without actually saying which sub I am going too fast, or what are the rate limits for each action in the relay, before and after AUTH. I have no actionable information. Others will say: "unexpected character in Then the only other two notices I get are "Failed to receive" because lack of payment and WOT. Which are fine, but also irrelevant because I don't have an invoice for the user to pay and I can't add WOT to the user. I can't find any other NOTICE in over 2 days using Amethyst. |
Depending on what you're talking about this is not a protocol issue, this is relays being clueless.
If you're sending too many subscriptions and being rate-limited because of that I don't see how the relay could say something different. The problem isn't in a specific subscription. Maybe you want the relay to say how many subscriptions you're sending and how many you're allowed to send per minute or something like that? That's something that can be improved at the specific relay codebase, but also some relays may not want to reveal that to an attacker.
This is something that should be moved to a
Same for these two.
Great, that means things are working as expected? Maybe once we get to a point in which relays only return NOTICEs for very rare relevant human-readable information we can more decently display those to users. |
No. It's lack of guidance from the protocol. No one knows what NOTICE is for and how to use it. It's way too abstract.
Great. You just validated the point that NOTICE should not exist (or at least, it should not be a mandatory requirement of implementing Nostr) and the messages should be moved to places where they can add more actionable information. |
Can you give an example of how you use it? |
I don't think anybody here has made the case that removing NOTICE makes things better. You might argue that it is confusing developers, or that it is confusing users, or pointless as things can be done in a different way. But none of those arguments leads to the conclusion that removing NOTICE makes nostr better. It makes it strictly worse because a client may then ignore them while some relay still expects them to be read. In general. nostr will have "cruft" (NIP-26 is another example), but cleaning up the "cruft" is not actually beneficial and could be harmful. The best I would support is deprecating NOTICE message creation on relays, but clients SHOULD still display them to users if they ever see them. |
I just want to see any examples of a useful NOTICE. |
Chorus uses it for the following cases:
Sure I could put "Binary messages are not processed by this relay" in the NIP-11, but when someone is debugging their client it is far more immediate and useful for them to see that as a message rather than spending hours and then noticing it in the NIP-11. |
@mikedilger The WebSocket close method supports a code and reason that can be parsed by the client: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket/close https://www.rfc-editor.org/rfc/rfc6455.html#section-7.4.1 For the binary issue, you'd want to close with a 1003:
For rate limiting, I would use
For "unexpected errors", I would like to see an example that wouldn't be solved by either CLOSED or a WebSocket close code. "Command unrecognized" is probably the best argument I've heard in favor of NOTICE. Although it's only useful in a CLI - in production NIP-11 would be used. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NOTICE is useful for relay debugging, and for providing more information to clients about why an OK/CLOSED message was returned.
Several people say NOTICE is good for debugging, but still no examples. I have never seen it be useful in that way. |
Mike Dilger has provided multiple examples, they're pretty close to what khatru does. |
@alexgleason Thank you, I could use the Close message codes for rate limiting. But not all errors are significant enough to close the connection. Binary messages for example, I'm not going to close I'm just not going to handle them and the notice is a nicety for developers who might wonder why their new binary-nostr client isn't working with chorus. |
NOTICE
is practically useless. I argue it has been superseded by a combination of NIP-11 and relayCLOSED
messages that were introduced 2 years ago in #902.I am implementing a relay. There are 2 beautiful flows of Nostr:
REQ
, to which the relay responds to withEVENT
,EOSE
, and/orCLOSED
.EVENT
, to which the relay responds with anOK
(which can be true or false).These are request/response flows, which map very well to async functions in code. But
NOTICE
exists outside of that - it's a callback with no useful destination.In some legacy relays (Strfry should send CLOSED for invalid messages hoytech/strfry#135),
NOTICE
was used to respond to subscription errors. However, it's impossible to parse, and therefore useless because it doesn't contain a subscription ID. The correct thing to use today is aCLOSED
message, with the subscription ID and reason.In the past,
NOTICE
may have been useful to tell users certain things about the relay. However, this was superseded by NIP-11, which is a superior way to find out relay information.Relays are not consistent in how they use
NOTICE
, so it cannot even be trusted by clients to display prominently to the user. Even for display in logs, there is basically nothing useful aNOTICE
message could actually say that wouldn't be communicated better with a CLOSED message or through NIP-11.I've built multiple relay server and client implementations, and none of them have ever supported
NOTICE
. There is no clear place for it because it's not part of any flow. It's not useful enough to display to users, and not even useful enough to display in logs. It has been totally superseded by far superior solutions. Since it's useless, there's no point in promoting it to people. So let's remove it.