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

Android: Add Rate-Topics: header to UnifiedPush subscriptions #652

Closed
binwiederhier opened this issue Mar 3, 2023 · 3 comments · Fixed by binwiederhier/ntfy-android#55
Closed
Labels
android-app ntfy Android app enhancement New feature or request

Comments

@binwiederhier
Copy link
Owner

For UnifiedPush topic subscriptions, we need to add a header Rate-Topics: ... to the JSON stream and WebSocket Connection, so that the server can rate limit based on the subscriber. Right now, this is done solely based on the topic name up<12 digits>, which was meant to be temporary.

@binwiederhier binwiederhier added enhancement New feature or request android-app ntfy Android app labels Mar 3, 2023
@binwiederhier
Copy link
Owner Author

/cc @wunter8 While you're in the Android codebase 😬

@wunter8
Copy link
Contributor

wunter8 commented Mar 3, 2023

Haha, I'll see if I can get to this over the weekend. What exactly am I doing, though?? Is there a Discord/Matrix thread I should refer to for context?

@binwiederhier
Copy link
Owner Author

Basically, you're listing all UnifiedPush topics in the GET request for the subscription connection, e.g.

# HTTP stream
GET /mytopic,up1234567890,backups-yolo,up11231323/json HTTP/1.1
Rate-Topics: up1234567890,up11231323

# Websocket
GET /mytopic,up1234567890,backups-yolo,up11231323/ws HTTP/1.1
Rate-Topics: up1234567890,up11231323

# Polling
GET /up1234567890/json?poll=1 HTTP/1.1
Rate-Topics: up1234567890

This will tell the ntfy server to register visitor as a rate visitor for the UP topics, but not the others. I am happy to give more details, but this is poorly documented, as it is still be ironed out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android-app ntfy Android app enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants