Browser push notifications

currantcata year ago

Hi,
Is it possible for my own Traccar instance to send push notifications from the browser? I am not talking about notifications in the mobile application itself or notifications as toasts in the application, but about native pushes available in many browsers.

I can see that the service worker works properly, so implementing such a mechanism should be easy. Unfortunately, I can't find any information about whether it has already been implemented in the documentation or on the forum.

Anton Tananaeva year ago

We don't support web push notifications currently.

currantcata year ago

I understand, thanks for your reply.

Spiroua year ago

Is this on the roadmap? Now iOS has support for web push notifications as well I believe this might be a very good alternative to app push notifications.

Anton Tananaeva year ago

Not on the roadmap currently, but feel free to create a request for it, if there isn't one already.

Bryan Zambranoa year ago

Como puedo poner sonido y vibracion a las notificaciones push en la app manager actualmente no suenan.

Anton Tananaeva year ago

Bryan, wrong place to ask.

Spiroua year ago

I am implementing web push notifications at the moment. When the app is open, I would want the notification to appear like it would be a normal traccar "web" notification. Anton, could you please tell me which call to make when handling the incoming push message so this appears as a toast in the app?

This is the content of the push notification being handled by the browser:

Object { from: "6468001426", collapseKey: undefined, messageId: "000d22e1-b4d7-4f3d-9370-523ffcxx8131", notification: {…}, data: {…} }
​
data: Object { eventId: "1607" }
​​eventId: "1607"
​​
from: "6468001426"
​messageId: "000d22e1-b4d7-4f3d-9370-523ffcxx8131"
​
notification: Object { title: "Device: online", body: "Device online at 2023-09-16 21:00:22\n" }
​​body: "Device online at 2023-09-16 21:00:22\n"
​​title: "Device: online"

I can do something with the eventid, but what...


Second question; when clicking on the push notification, I would like to go to a specific page in the app instead of the standard login page. For example, I would like to go to the page with the specific device from the notification selected. For this I think we should add a "url" to the notification, which doesn't seem to be the case right now. Could you please tell me which url should be opened on clicking a notification?