gotify / server

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

Allow the apps to send messages to specific clients #186

Open mike325 opened 5 years ago

mike325 commented 5 years ago

Right now apps broadcast messages to all subscribed clients, it would be nice if the apps could send messages just some of the clients, something like this

/message?token=<app_token>&client=<client_id>

Broadcast messages would still be available when the client_id is missing

jmattheis commented 5 years ago

Hey, thanks for your issue!

Do you have a specific use case for this?

We have a similar issue with a different solution https://github.com/gotify/android/issues/61 in there the client chooses to what applications it subscribes.

mike325 commented 5 years ago

I thought this could be useful in a couple of use case like

I also think gotify/android#61 can work together with this in the way you may want to silence the notifications even if they are target directly to your device

kallisti5 commented 5 years ago

This was one of the first requested features when I brought this up to my team. It would be nice to at minimum set target clients for notifications, or put clients into groups.

As a use case example, we get alerts for things when they break. If we could define "groups of clients interested in windows-related notifications, and groups of clients interested in linux-related notifications" it would go a long way.

van-beek commented 5 years ago

Yes this would be a nice feature. especialy for the stream websocket. subscribe to one application or send message to a client. Then one server can be used for mulitple apps.

ghost commented 4 years ago

When are you gonna add this feature?

jmattheis commented 4 years ago

I currently have other projects that I work on. Still, someone from the community can implement this feature if it is really needed :D.

Before someone takes this issue, it would be helpful to discuss the changes needed for this to work.. F.ex. if a client can see messages that were sent with another client id and only won't receive a push notification for it.

artfulrobot commented 4 years ago

I came to this issue thinking "Why can't I configure which apps get to send to which users?"

It seems the model at the mo is

many apps >--< send many messages >--< many users

I'm just using gotify personally, so that's fine, but I'd like to start using it for other purposes. Like I'd like to be able to add clients who will only get certain categories of message (and must not see others), which seems to be what this issue is about, although there are quite different ideas.

  1. this comment suggested that the client chooses which apps, from all of the apps available.

  2. Another suggestion thread, if I've understood, is that the app has to know which users to send to. It feels like we need a clearer layer of abstraction than this.

Seems a more standard architecture that apps' responsibility is just to generate notifications with sutiable metadata, then the server can use that metadata, including the source app and server configuration to arrange delivery to appropriate clients.

e.g.

App: notification (tags/categories/source app)

Server: (configured by admin user)

Clients:

Apologies if I've not understood anything or misrepresented the suggestions above!

eternal-flame-AD commented 4 years ago

@artfulrobot Yes, and I can certainly see that there is the need for this. The main issue why me (and I guess other collaborators) is hesitant on working on this is that it changed the data flow model significantly. Apps used to work solely independent of the client layer and they only care about producing messages, not knowing how many clients are there. Plugins like the gotify-broadcast I wrote can be used to get around this by providing the "category" layer through external plugins (in a rather dirty way tho).

I do agree with you that if we do this feature we are going to do it in the 2nd way you brought up (the "category" way). However, incorporating this idea into the main server just looked like too much disruption to the principle of keeping APIs simple by default (need a way to manage and sync configurations on categories to clients).

IvanTurgenev commented 4 years ago

Hey, thanks for your issue!

Do you have a specific use case for this?

We have a similar issue with a different solution gotify/android#61 in there the client chooses to what applications it subscribes.

yeah each application has clients, so clients can subscribe only to the apps which they have a token for

1RandomDev commented 1 year ago

Any updates on this? The request is now open since 2019 and a feature like that would be extremely helpful.

mredodos commented 1 week ago

I currently have other projects that I work on. Still, someone from the community can implement this feature if it is really needed :D.

Before someone takes this issue, it would be helpful to discuss the changes needed for this to work.. F.ex. if a client can see messages that were sent with another client id and only won't receive a push notification for it. I think it's better if the client can only see messages intended for him directly or those sent to all clients.

this system would certainly be very useful with a view to sending different communications to specific devices, based on the owner of the device or the role of the person who has that device, e.g., an administrator might want some specific info on a specific client while the rest of the clients don't.

it might also be useful to have options in addition to just sending the message to the clients also to be able to exclude it from those sent to everyone a sort of

send only to client id or send to all but client id

eternal-flame-AD commented 1 week ago

@mredodos I think I would prefer the application to stay unaware of the clients. There are a couple reasons for this:

an administrator might want some specific info on a specific client while the rest of the clients don't.

Not sure what you mean by this, what is the "administrator" here wanting to achieve? Audit messages to a specific client?

mredodos commented 1 week ago

@eternal-flame-AD

Personally, I’m not really interested in a discussion about groups and roles, and I don’t think they are strictly necessary (also considering the broadcast plugin, which I still need to fully understand how it works).

I was more in favor of simply directing the message to a single device.

There could be many use cases, ranging from a single one to a small group.

Let’s imagine having multiple IoT devices: I may want to receive some notifications on multiple devices, but others, maybe more urgent ones, on a single emergency device.

Or, for example, I need to receive notifications about work tickets being opened. I notify all my devices that there is a new ticket, but only send a more detailed notification to the work device, or one that, when clicked, connects to the ticket.

Or let's say I share notifications with my team, and I would like one of us to receive a specific and different message than the others.

Or maybe I want the sales notifications from my e-commerce only on my smartwatch or work phone, while on other devices, I want notifications for different things, like hobbies or other topics.

I absolutely agree with you that the focus is and should remain on notifications.

IMHO, mailing lists are not a suitable example since they (at least the full versions) have tags, categorizations, lists, etc.

If the broadcast plugin covers all these use cases, then I’m all set!

eternal-flame-AD commented 1 week ago

@mredodos thanks for the explanation

Sharing with a team is exactly the use case of my plugin. Each have a registered user and each choose which channels to send to and which to receive from. Also have more complicated features like selection by regex and such.

"Emergency devices" I am a little confused, if it is an emergency message don't you want every device to get it? Is it a security issue?

Work life balance is a good example, although I feel this is better done with a client-side solution than a server-side solution (like allowing notifications profiles that can change by a switch). It is already available on Android where you can turn off your sales application on your personal android device but can definitely be considered on the web UI too.

For work tickets I would just send the detailed ticket to a different user which I only log in from my work computer and still get notifications for personal or summarized-work things on my personal device logged in as the regular user. can you describe your setup which need a better solution than this?