官术网_书友最值得收藏!

Push notifications

There's no point in a chat application without notifications! Again, we're trying to emulate what has traditionally been a native app feature--push notifications directly to the user's device.

This problem is trickier than it might seem. Push notifications are only received when the app isn't open (that's the whole point, after all). So, if our web application isn't open and running, how can we possibly run the code to display a notification?

The answer is to use a third-party service that is engineered to send notifications to registered devices. So, rather than the device receiving the message alerting its user, the device sending the message alerts our notification service, which then notifies all relevant devices.

We also need a piece of code that is constantly "on"--always running and waiting to receive notifications from the third-party service and display them. This challenge only recently became solvable with web technology, and is one of the reasons PWAs are so exciting.

For now, don’t worry if this distinction doesn't "click" yet. We'll go into it in greater detail later. For now, the point is that push notifications will be an interesting challenge for our web application.

主站蜘蛛池模板: 定陶县| 屏南县| 普陀区| 西峡县| 察哈| 棋牌| 安阳县| 永州市| 九龙坡区| 呈贡县| 霍林郭勒市| 白银市| 繁峙县| 牡丹江市| 常宁市| 蒙山县| 崇信县| 齐河县| 资阳市| 嘉峪关市| 锦屏县| 丰城市| 红河县| 永安市| 台南市| 团风县| 新闻| 建瓯市| 曲靖市| 托克托县| 都安| 绥宁县| 陇川县| 娄底市| 遵义县| 吉木萨尔县| 昭平县| 琼中| 和龙市| 信阳市| 黎川县|