Why Nostr? What is Njump?
2025-04-12 18:37:44

mleku on Nostr: man, refactoring the #realy subscription system so it's modular and can have each api ...

man, refactoring the #realy subscription system so it's modular and can have each api separately disabled instead of only both on is proving complicated

the HTTP api is simple, there is literally just a channel that sends a context from the http request, the authed pubkey (if any), *one* filter, and a channel to receive new events on

in contrast, the websocket has three functions, one to add a new subscription, one to close a specific subscription of one socket, and to remove all of the subscriptions of one socket

i feel like the right way to do this is to make them uniform, so instead of having this complicated scheme, each subscription itself is distinct, but then i have the problem of supporting the closing of all the subscriptions of a socket, this is the main difference between the two interfaces

reconciling these two separate things into a uniform and simplified interface is really what i want to do here, and then each individual subscription has one filter and one close context, but i need a means to have all of them cancel at once...

i'm still a bit lost how to do this, but i'm gonna try and figure out a means to solve the problem

it's a juicy problem and i'm quite addicted to trying to solve it at the moment

i feel it is going to need something different, so where currently the sockets are not maintaining the state of their individual subscriptions, but using the websocket as a grouping for a set of subscriptions tied to one socket... >_< gonna figure this out soon

this is the hardest part of splitting the two apis apart, it's the place where they are connected to the relay's subscription management scheme, once i can have one uniform mechanism for distributing new events out and closing them as one or as a group i'll have it done and then i can put the implementations of the interface into each api package and then if the api is disabled it just isn't being checked, currently they are spaghetti

i hate websockets, did i mention that? they are such a messy construct for what should be a simple request/response
Author Public Key
npub1fjqqy4a93z5zsjwsfxqhc2764kvykfdyttvldkkkdera8dr78vhsmmleku