简体   繁体   English

如何在桌面网络浏览器(chrome,firefox等)上创建通知?

[英]How to create notifications on the desktop web browser (chrome, firefox, …)?

NodeJS is installed on my server. NodeJS已安装在我的服务器上。

I installed and configured the 4 modules below on my Drupal 8 site. 我在Drupal 8站点上安装并配置了以下4个模块。 When I see messages with "Private Message Messenger", I receive "jGrowl" notifications. 当我看到带有“ Private Message Messenger”的消息时,会收到“ jGrowl”通知。

https://www.drupal.org/project/private_message https://www.drupal.org/project/private_message

https://github.com/jez500/Private-Message-Messenger https://github.com/jez500/Private-Message-Messenger

https://github.com/jez500/Private-Message-NodeJS https://github.com/jez500/Private-Message-NodeJS

https://www.drupal.org/project/nodejs https://www.drupal.org/project/nodejs

My question : 我的问题 :

How to create notifications on the desktop web browser (chrome, firefox, ...) ? 如何在桌面网络浏览器(chrome,firefox等)上创建通知?

Here is the instant messenger : 这是即时通讯工具:

在此处输入图片说明

Currently when the user receives a message, he receives a notification on my site. 当前,当用户收到消息时,他会在我的站点上收到一条通知。 The problem is that if the user is not on the page of my site, he will not see that he has received a notfication. 问题是,如果用户不在我网站的页面上,则不会看到他收到了通知。

在此处输入图片说明

EXAMPLE: 例:

I have a nextcloud messaging. 我有一个nextcloud消息传递。 If I'm on another page and receive a new message, nextcloud sends a notification (sound and visual) on firefox (in my case I receive it in the ubuntu notification center). 如果我在另一个页面上并收到新消息,则nextcloud在firefox上发送通知(声音和视觉)(在我的情况下,我在ubuntu通知中心收到该通知)。

How to do this with my site ? 如何使用我的网站?

在此处输入图片说明

Notifications are added to browsers such as Chrome and Firefox using service workers. 通知会使用服务人员添加到Chrome和Firefox等浏览器。 Check out Push messaging sample for chrome. 查看Chrome推送消息示例。

Also check out this article on web push Notifications 还可以在网络推送通知中查看此文章

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM