10 ms·
Gotify – a self-hosted push-notifications service
- eponeponepon 8y agoNeat. I could definitely use this for some home infrastructure I'm playing around with at the moment - will definitely give it a shot!
- draugadrotten 8y agohttps://gotify.net/ https://gotify.net/
- dlhavema 8y agoInteresting project. Is this intended to replace Firebase Cloud Messaging on android or be a wrapper in front of it? I only saw android support, anything for iOS in the works?
- dgivney 8y agoFrom 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 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 look under the hood. There's nothing I can see that would stop you using this for iOS so maybe they just don't have a iOS dev on the project. Edit: Ah, here's why. https://github.com/gotify/server/issues/87 https://github.com/gotify/server/issues/87
- dlhavema 8y agoThanks for clarifying. This could be a good solution for a non Google play type phone, or just someone who doesnt want t rely on Google servers. It would just mean in the latter case there would always be 2 open connections listening for messages...
- damian2000 8y agoThose open connections would be very hard to keep open indefinitely in an Android app that gets optimized or goes into sleep / doze mode.
- zmmmmm 8y agoSo, 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 store.
- petronio 8y agoEither 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).
- rubenbe 8y agoI gave it a quick try and "it just worked" with minimal configuration. Really easy to get started. Unfortunately messages are only plaintext.
- winrid 8y agoUse JSON
- johnchristopher 8y agoSame. I wasted more time this evening setting up octobercms behind a reverse proxy (hours, not working) than getting that server handling notifications from a VPS running many small services.
- johnchristopher 8y agoLogo reminds me of traefik. Is it related ?
- francislavoie 8y agoThat's the Go Gopher: https://blog.golang.org/gopher https://blog.golang.org/gopher
- johnchristopher 8y agoThanks ! That mascot is super cool.
- etxm 8y agoI cannot tell is this is a sarcasm. It’s the go gopher... gophing about.
- johnchristopher 8y agoIt's not :).
- NicoJuicy 8y agoOff-topic I got so scared when I looked at the swagger. The authentication uses the exact same variables as mine and is somewhat similar. The name of the endpoints are also very similar and the project has resemblance to mine. That was really really akward for a moment. I'll use the project though ( different use-case), looks really interesting. Coincidentally it's for the same project as I mentioned.
- dmitrygr 8y agoIt 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 alives than YOU need to keep your connection alive. This means fewer wakes from sleep mode and lower power.
- nbevans 8y agoIs that because carriers have put GCM/FCM on some sort of white-list?
- pas 8y agoProbably because GCM/FCM has been very well optimized.
- wasyl 8y agoWhile it's likely true, GCM/FCM is handled by Google Play Services, which is whitelisted and has I believe system-level permissions. It has less restrictions than a regular app exempt from battery optimisations, as it's supposed to be the only app that needs to run in order to coordinate things like push messages or location updates across all apps on the device edit: I missed that the original post was talking about keep-alives and you were probably referring to them. But how app-level optimisations can help with keep-alives?
- fyfy18 8y agoTCP 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/usingkeepalive.html 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.
- canada_dry 8y agoBah... no linux 32 bit binary for my old home-automation server.
- adraenwan 8y agojust build it yourself :) $ git clone https://github.com/gotify/server https://github.com/gotify/server $ cd server $ env GOARCH=386 go build
- blumomo 8y agoThe documentation states that End2End tests are included. I didn't find them in the repository. I want to learn from the tests - Can somebody please help me and point me to the End2End tests?
- noahster11 8y agoAlthough I've been using Pushover[0], a paid service, instead of Gotify, I found a really cool project to pair a push-notification service with is huginn[1], which allows you to program bots to do things on cron jobs, among other really powerful actions. [0] https://pushover.net/ https://pushover.net/ [1] https://github.com/huginn/huginn https://github.com/huginn/huginn
- there 8y agoJust to clarify, Pushover is not a "paid service" in that you need to pay for a subscription. You only have to pay once to use it past the 7-day free trial.
- nukeop 8y agoI'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?
- npmn2 8y agoIt is not needed for displaying the notification but specifically targeting users. You would usually call an FCM function to get a token, which can be used to specifically target that user and is stored in the database. To send a notification to your customised target audience based on user-generated events, it becomes essential to use web-service that does it for you. For example- Let's say you wish to send a notification to user A when user B sends him a message. In this scenario, you can call another FCM fn, using the token user A had generated. Of course you can use the web dashboard to send the notifications, but in this case, you would not be able to send event-based notification reliability and in real-time. Other services also work in a similar manner.
- izacus 8y agoOf course FCM also has notion of channels where you can broadcast to certain topics (which apps listen to) without having to track tokens on application server side.
- johannes1234321 8y agoYou need a way to tell the mobile device that a new message has been received. Since you don't have a fixed IP or anything there is no way to directly send the message. An alternative is that the mobile device pulls from time to time, but that's quite power intensive or, when using a long interval, is slow. Instead one has an idle connection open to which the server can send messages.
- ktjfi 8y agoSending a curl to an endpoint from the client is not push but pull. The idea of push notifications is that they arrive immediately.
- 8y ago
- benoliver999 8y agoFunny, 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.
- callalex 8y agoSending a text message uses the GET verb? Yuck.
- verelo 8y agoI get why that's "yuck" but if I'd hedge a bet...it's probably done because it's easier to make a GET than it is a POST or PUT request and the length of a text message will never exceed the query string uri length limits. Not saying I disagree, but i don't know it changes a whole lot in this case.
- beager 8y agoIn this case maybe, but generally GET should be avoided for any creative/transactional action because many systems will replay/cache GET requests, assuming that they’re idempotent.
- verelo 8y agoYeah the caching issue is a great reason not to use a GET, i was more just suggesting if you're being lazy and pasting a request into a browser v's using a command line (which obviously you should) then it's easy to get going quickly to kick the tires.
- Groxx 8y agojust to point out: there are no uri length limits. browsers typically have one (I haven't checked lately tho), but other tools generally don't (except by mistake / size-capped buffers).
- skybrian 8y agoHmm, I didn't see anything about security while skimming the docs?
- linkmotif 8y agoIs 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!
- entropie 8y agohttps://en.wikipedia.org/wiki/Push_technology https://en.wikipedia.org/wiki/Push_technology
- linkmotif 8y agoRight 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?
- saagarjha 8y agoiOS does its own thing, FWIW: APNS (https://en.wikipedia.org/wiki/Apple_Push_Notification_Service https://en.wikipedia.org/wiki/Apple_Push_Notification_Servic...)
- linkmotif 8y agoThank you!
- dgivney 8y ago> 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.
- dgivney 8y agoI think Push API is an industry standard but there is this W3 draft https://www.w3.org/TR/push-api/ 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.
- triplewipeass 8y agoUseless without iOS support. What’s the point of an abstraction that has only a single implementation?
- jkarneges 8y agoI'm not sure, but I don't think iOS lets apps auto-start and run in the background forever. This would be needed for any alternative push notification app, else it would be too easy to miss notifications.
- triplewipeass 8y agoAs stated previously: this is useless. What is the point of building alternative push notification services that can’t even properly rise above the bar of technical feasibility?
- saagarjha 8y agoIt doesn't, but iOS will wake your app up when it receives push notifications.
- lazyant 8y agojust write a Twilio or Slack plug-in?
- wybiral 8y agoAwesome! I've been working on a collection of news source parsers [1] (a combination of RSS and HTML scrapers) that this will work perfect with to replace my native news app. All I have to do is pipe the lines from my parser through a Python script issuing these message POST requests and it just works out of the box. [1] https://github.com/wybiral/stream-sources https://github.com/wybiral/stream-sources
- born2discover 8y agoAwesome! This opens the door to so many possibilities!
- 188201 8y agoFCM 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?
- gruez 8y ago>FCM is integrated in kernel, so it cannot be killed. What do you mean it's "integrated in kernel"? Are you saying google play services includes a kernel module?
- londons_explore 8y agoIt does not. It's a plain-old TCP connection in GMSCore, but has special permissions to ignore various power save modes. I personally wish Google would work with mobile networks to replace it with something lower level (eg. Based on the same thing used to initiate phone calls), because a hanging TCP connection open for many hours gets unreliable as NAT drops it and as the phone migrates from one mobile network to another (eg. Across country boundaries)
- sofaofthedamned 8y agoThat was how BlackBerry worked wasn't it?
- nimrody 8y agoIt's handled by Play services which is whitelisted to allow network access when the device is in light/deep doze mode. Play services can also instruct Google's servers to stop sending notifications when the device is in deep doze and re-open the connection when the device is active again -- thus saving power (messages are queued at Google's servers)
- 8y ago
- wiradikusuma 8y agoI like the idea of the project, but I'm curious. Why would you need a self-hosted (or really, any other push-notif service) other than the official one from Apple/Goggle? They're optimized (for each respective platform), no need to maintain a server, and free. If you need "cross-platform", you can use Firebase(?) that abstracts that away.
- wybiral 8y agoPrivacy? Keep in mind that not everyone intends to build a user-supporting platform on this tech. I like the concept because it's an easy way for me to push notifications from my homebrew IoT stuff and news streams without it flowing through ad companies.
- there 8y agoYou can encrypt notifications that go through Google's FCM and Apple's APNS push notification servers. This is how Pushover works - each notification is encrypted with a device-specific key, sent through the notification servers as an encrypted blob, then the app on the device is woken up and receives the blob, decrypts it, and posts it as a normal notification.
- wybiral 8y agoYou could. But if you don't need that kind of added complexity and scale (and I don't for personal news updates or IoT device alerts) then why jump through those hoops?
- zuron7 8y agoI think the major reason this was created was for apps on the F-Droid store and for people who prefer not to have Google Play Services installed on their phone.
- sberder 8y agoConsider that some countries do not have a reliable access to Google backend. The problem remains when trying to use notifications with a PWA. AFAICT, there's no way to set your own notification service in Chrome/Firefox/Safari.
- AlfeG 8y agoHave anyone used Nats as a push notification service? We are looking for alternatives to Google Play Services.
- rakoo 8y agohttps://pushpin.org/ https://pushpin.org/ is another alternative that has some history, has support for more protocols and is used in production by its creators
- siscia 8y agoI would like to point out that there exists solutions tested in the field in the last 20 years to solve the same problem. In particular I would suggest to get to know MQTT an open protocol with several (open and close) implementation that is know for its flexibility and scalability (if nothing has changed it is used to power the Messager Facebook platform, but don't quote me on that). verneMQ is the server implementation I would suggest if you are interested in such topic.
- qwertox 8y agoMQTT is just a protocol, not a service. I don't think it was the developer's intention to provide an alternative to MQTT, but to offer a solution for push-notifications, which just happens to be built on top of WebSocket without MQTT. Also keep in mind that MQTT will usually get wrapped by WebSocket to avoid issues with firewalls or to easily get TLS via a proxy server like NGINX, or simply to add web browser support. VerneMQ is not the only server implementation for MQTT.
- siscia 8y agoReally, what your comments add to the discussion? You just re-phrased everything I said in a more negative tone with zero value added. I said myself that MQTT is a protocol and again I said that verneMQ is an implementation of the broker, the one that I suggest but not the only one. And yes, it was a choice to leave aside the implementation detail of the use of websockets for MQTT because is a different level of abstraction. Please let's try to add value to the community and not just add noise and entropy. Before to comment I asked myself. 1) does this need to be said? And since people where finding this project interesting I decided that yes, the same people could be interested in knowing another more mature ecosystem that target a similar niche. 2) does this need to be said by me? And again, yes, none mentioned it already, the post was up for a while and I do have production experience with MQTT. Please try to follow the same guidelines!
- d76d6776yudsy 8y agoBlah bleh bluh
- sandos 8y agoThis is what home assistant needs! The only really lacking thing about HA is the lack of native Android app, but the most important thing is notifications.