Skip to content
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

NIP-01 what is the max length of subscription_id? #240

Closed
noobdummy opened this issue Feb 11, 2023 · 9 comments
Closed

NIP-01 what is the max length of subscription_id? #240

noobdummy opened this issue Feb 11, 2023 · 9 comments

Comments

@noobdummy
Copy link

<subscription_id> is a random string that should be used to represent a subscription.

what is the max length of subscription_id?
is there a limit?

@fiatjaf
Copy link
Member

fiatjaf commented Feb 11, 2023

Whatever relays want to allow. I was running a relay I wouldn't allow more than 64 characters.

@fiatjaf fiatjaf closed this as completed Feb 11, 2023
@barkyq
Copy link
Contributor

barkyq commented Feb 11, 2023

I only allow 20 characters on mine. If it is larger than that the relay responds with a NOTICE and doesn't accept the subscription.

@mikedilger
Copy link
Contributor

gossip client uses 32 characters, 16 representing the time, 16 being random. I guess we aren't talking to @barkyq 's relay.

@barkyq
Copy link
Contributor

barkyq commented Feb 12, 2023

Whoops @mikedilger I will update that :) I just figured that, since it only needs to be unique per websocket connection (on my relay), more than 20 chars was a bit overkill, and that is 20 bytes on every returned event...

@barkyq
Copy link
Contributor

barkyq commented Feb 12, 2023

I also just revealed that I do not use gossip lol sorry mike I hear it is very good though. one day I'll get that set up

@mikedilger
Copy link
Contributor

your right @barkyq they don't have to be 32 characters. I could just use 2 characters and count up from zero.

@barkyq
Copy link
Contributor

barkyq commented Feb 12, 2023

It's your call, I will change the max_subid_length to 32 on my relay though

@mikedilger
Copy link
Contributor

No, no you're right. No I mean I'm right that you're right. :-) Let's both make the change.

@barkyq
Copy link
Contributor

barkyq commented Feb 12, 2023

Sounds good. Thanks for letting me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants