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

Use Push notifications #27

Open
davidak opened this issue Feb 23, 2022 · 18 comments
Open

Use Push notifications #27

davidak opened this issue Feb 23, 2022 · 18 comments
Labels
blocked Something that can not be fixed by the project itself currently due to circumstances enhancement New feature or request help wanted Extra attention is needed

Comments

@davidak
Copy link

davidak commented Feb 23, 2022

As it can be critical that notifications are delivered instantly, Push notifications should be used when technically possible. (Android with Google Services or microG)

If not possible, tell the user that it takes up to 15 minutes to manually check and offer instructions to install microG (it is very hard, maybe not viable).

This might decide between live and death of a user or their family!

@nucleus-ffm
Copy link
Owner

It would be really cool to have that, but for any kind of push services (maybe with a websocket) I would need a webserver, but I don't have one. And even if I were to rent one, I'm not sure I'd have the time and skills to maintain the server all the time. Also, I had to think about how to finance the server.

@davidak
Copy link
Author

davidak commented Feb 23, 2022

I understand it's not easy. Maybe a solution can be found.

Maybe you can find contributors who love to maintain a server.

Would funding help? The project might have a good chance to get funding from Prototype Fund.

@jugendhacker
Copy link

Maybe unified push could be used so that it will still be compatible with F-Droid? Fluffychat does this for example.

@budda85
Copy link

budda85 commented Feb 24, 2022

There is for example Ntfy .
It is very easy to install. Fluffychat has automatic create an pushservice with ntfy.

@jugendhacker
Copy link

@budda85 yeah Fluffy just uses unified push, which Ntfy happens to be one provider for...

@nucleus-ffm nucleus-ffm added enhancement New feature or request help wanted Extra attention is needed labels Aug 12, 2022
@citizenserious
Copy link

citizenserious commented Aug 20, 2022

NextPush would be an option for me and maybe for others too. It is implemented in fedilab and Element as an example (:

@bt90
Copy link

bt90 commented Dec 8, 2022

I'm not sure if an ntfy server alone would cut it. Aren't the UnifiedPush endpoints autogenerated? e.g. https://ntfy.sh/upMg6xDhy2UGUW

So we would need an additional service to handle registration and publishing for these endpoints.

Being able to register a UP receiver for a predefined server and topic would avoid that.

@binwiederhier is this possible?

@bt90
Copy link

bt90 commented Dec 8, 2022

@binwiederhier (had a typo in your username)

@karmanyaahm
Copy link

karmanyaahm commented Dec 11, 2022

Yes, just UnifiedPush alone won't do. Currently, the app talks to the government API every so often. But, for push, there would need to be a server that talks to that API, perhaps every 15 seconds, and then pushes to everyone registered on that server.

@vkrause is currently experimenting with a server like that for KDE, and since it sends data over UnifiedPush, it should work even for an Android app.

See: https://floss.social/@VolkerKrause/109477562343881737
And the server: https://invent.kde.org/vkrause/kpublicalerts/

@ChaosNicro
Copy link

I have seen people successfully parse server notifications to an https endpoint, tricking the server into sending to a UP distributor. But with no insight into NINAs communication protocol, that wont be viable.

@nucleus-ffm
Copy link
Owner

@ChaosNicro I am not sure I understood your post correctly. Can you give me an example of someone who has done this?

@nucleus-ffm
Copy link
Owner

Btw, here's a quick update on this topic.

We are currently experimenting with a push server written with NodeJS that uses unifiedPush to manage subscriptions and send push notifications. The server is of course also open source https://github.com/nucleus-ffm/foss_warn_server. At the moment it is still very simple and limited to the bare essentials - just for experimenting. The Flutter part is also in progress in the https://github.com/nucleus-ffm/foss_warn/tree/push-service branch. Since the whole server part is new to me, it would be great if someone would help me with it

However, there is a big problem at the moment. The Flutter connector https://github.com/UnifiedPush/flutter-connector is not compatible with the AlarmManager at the moment. When the AlarmManager is initialized, the callback functions of the Flutter connector for e.g. new Message are not called. I have already created an issue for this UnifiedPush/flutter-connector#123 If someone here has an idea how to fix this, maybe they can help to solve the problem.

@nucleus-ffm nucleus-ffm added the blocked Something that can not be fixed by the project itself currently due to circumstances label Apr 22, 2023
@ChaosNicro
Copy link

ChaosNicro commented Apr 25, 2023

@ChaosNicro I am not sure I understood your post correctly. Can you give me an example of someone who has done this?

Sorry, I was drawing from Telegram-FOSS-Team/Telegram-FOSS#577 (comment)
Like I said, probably not an option. The idea is to impersonate a (NINA)-Client and have the server send updates to a given UP-Server when registering the client. But that's not easy with proprietary apps. It's just odd that a public service like this doesn't just provide an open push-option, but just a polling-API.

@p1gp1g
Copy link

p1gp1g commented May 7, 2023

@nucleus-ffm I have tested with unifiedpush:^5.0.0 and it seems the issue is resolved. Could you try it ?

Edit: False alert :(

@nucleus-ffm
Copy link
Owner

nucleus-ffm commented May 7, 2023

@p1gp1g I tried it and as before, as soon as I initialise the AlarmManager, the callbacks stop working. I tried unifiedpush:^5.0.0 and android_alarm_manager_plus: ^2.1.4 with the UnifiedPush example app. @MatsG23 maybe you could try this too?

@p1gp1g
Copy link

p1gp1g commented May 7, 2023

I have probably been too fast with my tests with Foss_Warn. Sorry for the ping

@MatsG23
Copy link
Collaborator

MatsG23 commented May 7, 2023

When I try running foss_warn_server, I get this error in the console:

SQLITE_CANTOPEN: unable to open database file

Must I create this file somehow or do you have to check it in to Git?

Can the dialog in the app saying that you would need to install a distributor ignored? Could you also give me some more instructions on using the server? I saw you created some python files, do I just have to run testRegistration.py after starting the NodeJS server?

@nucleus-ffm
Copy link
Owner

nucleus-ffm commented May 7, 2023

@MatsG23 Oh yes, sorry. I forgot to check if the db folder existed and if not, to create one. I have corrected this and pushed the changes. Also the FOSS Warn part is now updated. It should work now.
You will need to install a distributor. I use ntfy

How to use the server:

  • Start the server (I use nodemon for this).
  • Start FOSS Warn (and for now edit lines 47 and 48 in main.dart to disable the alarmManager).
  • Select a new location in FOSS Warn
  • The data is sent to the server
  • The server should now output the client table with the new entry.
  • You can now comment out line 96 in server.js to run jsonWorker.loadJson() and restart the server.
  • The server should now call the NINA API (only once for now) and send a push notification if needed.

The Python scripts are only for testing the server. They just send a dummy request to the server to check if it works as expected. If you want to test the server, just run the testRegistration.py file and you should get a "success" back.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Something that can not be fixed by the project itself currently due to circumstances enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

10 participants