gotify / server

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
https://gotify.net
Other
10.72k stars 600 forks source link

iOS-App #87

Closed jmattheis closed 5 years ago

jmattheis commented 5 years ago

It would be great to have an iOS app for Gotify. Maybe someone from the community could contribute such an app as I do not have any experience with iOS/swift.

eternal-flame-AD commented 5 years ago

I'm afraid the biggest obstacle would be Apple's strict restrictions on background services. We cannot keep a persistent WebSocket connection in the background without abusing some APIs, which will absolutely disqualify the app from going onto the App Store and drain the battery significantly. Notifications could only be delivered through APN, which requires a developer account and a central server to manage notifications and send them to Apple before reaching the user, but this is not what gotify is designed for.

jmattheis commented 5 years ago

Thanks for your insight @eternal-flame-AD. It sucks that iOS has such strict restrictions.

I'm closing this issue for now because gotify will not use any third party service to deliver messages.

je-s commented 3 years ago

@jmattheis Do you think it would be a viable option to at least have a client which displays and receives old and new push notifications while in the foreground, without the functionality of actually getting push messages over Apple's push notification service? I know this would -at least partly- subvert the reason and meaning behind such a push service and, especially, a corresponding notification app, but it would at least make a live-view mode available, and you could use it to manually check for new notifications.

My current assumption is that for instance PushOver and Catapush use APNs to at least notify that there is new data, which then again is probably triggering a "pull" of the actual data from their respective services/endpoints. But this unfortunately requires using the APNs. Maybe it'd be an option to make something like that available as an optional plugin/extension, which connects to the APNs and takes over the part of notifying for new data?

Nevertheless, I'm going to make some research on this topic in the next few days, and see if I find any possibility with which this could be worked around. I'm going to look into the exact restriction of background jobs on iOS. It seems that the German Corona Warn App is using a mechanism to display messages from the background without push notifications. Maybe there's at least a possibility to run something like a REST request periodically, to check whether there are new messages or not. (Maybe that's inexpensive enough from a power consumption perspective.) If that would be feasible, we would at least have the option to display something like "There are X new notifications. Open the Gotify App to check 'em out."

jmattheis commented 3 years ago

Sure, an app with limited functionality is better that no app at all (:

Pushover encrypts messages with a device key, thus, transmitting the whole message via APN/FCM -> https://support.pushover.net/i46-are-messages-notifications-encrypted

Yeah, probably iOS has some kind of periodic job, in which new messages could be fetched.

GalvinGao commented 3 years ago

By using the Push Notification Extensions the one may send encrypted messages to the device endpoint and the device would be possible to decrypt it using the extension. However, quoting "I'm closing this issue for now because gotify will not use any third party service to deliver messages." I doubt that this would be a place for the gotify team to go though...

heywoodlh commented 2 years ago

Not re-opening this issue, but I think this is relevant to share here.

Just switched back over to iOS from Android and was bummed to find there is no Gotify iOS app. So I wrote a little shell script that watches the Gotify stream and then sends me notifications through Pushover using ntfy.

Here's the relevant snippet:

#!/usr/bin/env bash

token='xxxxxxxxxxxx'
uri='ws://192.168.1.10:8000/stream'

while read line
do
        ntfy send $(echo ${line} | jq -r '.message')
done < <(websocat -H "X-Gotify-Key: ${token}" -t - autoreconnect:"${uri}")

This snippet will read each newline that websocat receives and send it to me via ntfy. You can replace ntfy send with whatever command you want to use that sends you notifications.

This setup is nice because I don't need to switch everything to Pushover, I can keep Gotify for all my notifications.

EDIT: I updated the script with the autoreconnect overlay so it can handle Gotify going down and coming back up.

najtin commented 2 years ago

Just switched back over to iOS from Android and was bummed to find there is no Gotify Android app.

not sure what you mean: https://github.com/gotify/android https://play.google.com/store/apps/details?id=com.github.gotify

najtin commented 2 years ago

Ahhh forgive me. You meant that there is no Gotify iOS App. got it. sorry.

heywoodlh commented 2 years ago

Whoops, yeah, sorry for the typo @najtin! Fixed it.

createcandle commented 2 years ago

I'm closing this issue for now because gotify will not use any third party service to deliver messages.

But couldn't an iPhone app with periodic checking connect to the self-hosted server once in a while to get new messages? And when the user opens the app? See the background fetch details here.

A delayed message is better than nothing.

strider72 commented 2 years ago

But couldn't an iPhone app with periodic checking connect to the self-hosted server once in a while to get new messages? And when the user opens the app?

When the user opens the app, sure. But for background notifications, the developer has to specify the server, and that server has to send via Apple's notification servers. There's no way to make an app that allows the user to choose a server that sends background notifications.

createcandle commented 2 years ago

Yes I understand. My point was that an app without background notifications could still be useful.

niwla23 commented 2 years ago

what is the problem with APN? Maybe one could build an adapter that receives gotify notifications to GCM and APN for reliablea nd energy efficient notifications on IOS and Android? I don't know if using APN costs any extra money, but for GCM it does not AFAIk

EDIT: Found this alternative which works on ios and android: https://ntfy.sh/ haven't tried it yet though EDIT2: Works fine on Android, will test iOS later

mabed-fr commented 1 year ago

ntfy is perfect and self hosted. IOS work verry well.

heywoodlh commented 1 year ago

Just FYI for those getting thread notifications, I updated my script in my comment to autoreconnect when Gotify goes down and comes back up: https://github.com/gotify/server/issues/87#issuecomment-954891816

Maxiggapp commented 1 year ago

Thank you for this app. That would actually work with the Android devices. however, we all use iPhones and it would be a great achievement if this app ran on iOS as well. Therefore I would offer you my Apple developer account and one of my professional industry servers for free use. My IBM servers are in southwest Germany and are connected to a secure network. Please let's test this and let me know... Many greetings from Germany...

nallej commented 7 months ago

Take a look at the iGotify-Notification-Assistent

BetterB0y commented 4 months ago

Have you heard about this? https://developer.apple.com/videos/play/wwdc2020/10113/ https://developer.apple.com/documentation/networkextension/local_push_connectivity

MxD-js commented 3 months ago

There is a iOS App. iGotify on the ios app store by this awesome Dev >Sebastian Rank

https://apps.apple.com/us/app/igotify/id647345512