Live data from Hacker News

Gotify – a self-hosted push-notifications service

github.com

51–60 of 100 posts

Re: Gotify – a self-hosted push-notifications service

#51
post #22
post #15

Earlier quoted context omitted.

Probably because GCM/FCM has been very well optimized.

TCP connection can be open and idle for hours without keep alives. This can easily be configured with kernel parameters: https://www.tldp.org/HOWTO/TCP-Keepalive-HOWTO/usingkeepaliv... I suspect the hard bit for normal apps is keeping the app active on the device while it is in the background. Google has their FCM receiver running as a low level service so can make sure it is always running.

You can configure it locally in your kernel, but your ISP will most likely close your connections for you, especially if you're behind a CGNAT.

Re: Gotify – a self-hosted push-notifications service

#52
post #23

I'm not up to date with Android, but why does displaying notifications require an entire server or a paid service? Is it not just a matter of installing a client program and sending a curl to an endpoint?

Sending a curl to an endpoint from the client is not push but pull. The idea of push notifications is that they arrive immediately.

Re: Gotify – a self-hosted push-notifications service

#53

Is there a standard understanding of what are push notifications? Are they the same for android and iOS? I’m not sure what this project is about!

I think Push API is an industry standard but there is this W3 draft https://www.w3.org/TR/push-api/

But yes, it's essentially implemented the same across iOS/Android and browsers like Chrome, FF, Edge etc. There are services such as Amazon SNS or Google Firebase that provide a single interface which can talk to all the slightly different implementations.

In a nutshell the device registers to the server and receives an identifier token. Then a server can send messages to that identifier and the message will be displayed on the screen. Some providers allow for Icon, Audio and some Actions to also be sent as part of the message payload.

Re: Gotify – a self-hosted push-notifications service

#54

Earlier quoted context omitted.

https://en.wikipedia.org/wiki/Push_technology

Right but as the article shows, there are many "push technologies"... what is this project about? Someone subscribed for notifications and then this server sends them?

> what is this project about? Someone subscribed for notifications and then this server sends them?

Exactly that. A device registers with the server and then there's a REST API or CLI binary that you can use to send it push notification messages.

Re: Gotify – a self-hosted push-notifications service

#55

Funny, I was just looking for an alternative to pushover that doesn't use google services last week. Tested this and it worked quite well. I actually wound up just using an SMS gateway provider with a simple API you can just fire a get request to.

I had exactly the same problem, and ended up using Signal. I like it more than normal push notifications because you can reply and have a full chatbot running. I liked it so much that I even wrote a small Python library for it: https://gitlab.com/stavros/pysignald/

That's pretty neat, but could you add an Open Source license to it? It's gonna make folks hesitant to use it.

Re: Gotify – a self-hosted push-notifications service

#56
post #23

I'm not up to date with Android, but why does displaying notifications require an entire server or a paid service? Is it not just a matter of installing a client program and sending a curl to an endpoint?

> I'm not up to date with Android, but why does displaying notifications require an entire server or a paid service? Is it not just a matter of installing a client program and sending a curl to an endpoint?

Imagine if every program on the users phone had their own schedule for checking for updates against remote hosts. That sounds terribly inefficient and wasteful of power, as the applications would need to "wake up" (as in, consume processor cycles) to initiate and perform a check.

Re: Gotify – a self-hosted push-notifications service

#57
post #12

It is worth noting that this will use a noticeable amount of power more than Google cloud messaging. The basic idea of how is works is about the same, but the devil is in the details. If you look at an idle connection over LTE, you will notice that after a while your carrier will close it. You need keepalives. If you look at the connection for Google cloud messaging, you might notice that it needs much fewer keep ali…

Is that because carriers have put GCM/FCM on some sort of white-list?

Yes. Google/Apple have special deals with carriers.

https://0xacab.org/leap/bitmask_android/issues/2226#note_921...

https://news.ycombinator.com/item?id=17946320

Re: Gotify – a self-hosted push-notifications service

#58
FCM is integrated in kernel, so it cannot be killed. And it starts a persistent TCP connection to Google server. If all apps uses FCM, then all notification would route through this connection, and this significantly reduce battery consumption than the alternative, where each app uses its own web socket server.

So, assume using a degoogled android, can this notification replaced FCM if more apps use this notification server? This server uses web socket, so what does FCM use for its connection? Does web socket battery efficient enough?

Re: Gotify – a self-hosted push-notifications service

#59
post #48
post #9

Earlier quoted context omitted.

From what I can tell it appears to be a replacement FCM/APNS. The client subscribes directly via websocket to a self-hosted server (Go binary). New messages in the queue are then notified (gotified) via the websocket. https://gotify.net/api-docs#/message/streamMessages The payload can be picked up and managed via REST API as well. I'm building a similar solution for a slightly different usecase, so wanted to have a l…

So, their conclusion in the end that it is technically impossible to build a self-hosted notification solution on iOS due to Apple's restrictions. Shame because I would love to be able to deploy something like this internally at work, but of course, half the business is walking around with iPhones. I'm kind of curious though why it doesn't ruin every single XMPP client out there - there seem to be a few on the App st…

Either the server is sending pushes through APNS or the client is simply not getting messages reliably when the screen is locked or the app backgrounded, as the network restrictions very much apply to those clients as well (and to everything, to save power by sleeping the NICs).

Re: Gotify – a self-hosted push-notifications service

#60
post #17

It is worth noting that this will use a noticeable amount of power more than Google cloud messaging. The basic idea of how is works is about the same, but the devil is in the details. If you look at an idle connection over LTE, you will notice that after a while your carrier will close it. You need keepalives. If you look at the connection for Google cloud messaging, you might notice that it needs much fewer keep ali…

Not only that, but for many manufacturers this will straight up either not work after the app has been in the background for some (not long) time, or will deliver (that is, app will be able to connect and receive) push notifications with significant delay. Sadly, most reliable way I know to trigger push notifications when app is closed is using FCM - I'd love hear if there's an alternative, though.

Doze mode nukes network connections that are not FCM.
Post reply on HN