-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: add endpoint for registering alby go notifications #128
base: main
Are you sure you want to change the base?
Conversation
internal/nostr/expo.go
Outdated
}) | ||
} | ||
|
||
for _, existingSubscription := range existingSubscriptions { |
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.
could the DB query above be improved instead of having to do a for loop after (more filtering?)
internal/nostr/nostr.go
Outdated
go svc.startSubscription(svc.Ctx, &subscription, nil, svc.handleSubscribedEvent) | ||
handleEvent := svc.handleSubscribedEvent | ||
if sub.PushToken != "" { | ||
handleEvent = svc.handleSubscribedExpoNotification |
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.
Can the naming be improved here? we are still handling a subscribed event, right - we're just notifying in a different way?
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.
Changed to be simple - handlePushNotification
, wdyt?
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.
I think it's still inconsistent with handleSubscribedEvent
cmd/server/main.go
Outdated
@@ -50,6 +50,7 @@ func main() { | |||
e.POST("/nip47", svc.NIP47Handler) | |||
e.POST("/nip47/webhook", svc.NIP47WebhookHandler) | |||
e.POST("/nip47/notifications", svc.NIP47NotificationHandler) | |||
e.POST("/nip47/notifications/go", svc.NIP47ExpoNotificationHandler) |
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.
don't use app specific names here.
You implement an universal API here that can also be used by other applications.
(e.g. /nip47/notifications/expo
)
Also try to be consistent.
maybe we move the webhook endpoin then to:
/nip47/notifications/webhook
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.
Done 👍
Regarding webhook, it's a one-time notification endpoint, and it would also be a breaking change. Should we do that?
To register:
Make a
POST
call tohttp://localhost:8080/nip47/notifications/go
with body:It'll then start subscribing to all notifications of the app pubkey on the relay and keeps sending notifications to the mobile app