leapchat
leapchat copied to clipboard
When message received, show HTML5 Notification
See https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API
Could maybe use https://github.com/mikaelbr/node-notifier for this, but I'm not sure if it'll work in the browser (I, @elimisteve, got errors before, but I surely didn't use WebPack/Browserify/etc properly to transform it into something browser-compatible).
Example usage from @jimmcgaw: https://github.com/cryptag/backchannel/commit/79dc95332ce48b0d3b79056876ccc3d97b486fdb
I wasn't aware of this API. Pretty cool. I'm not sure we've given enough thought to read vs. unread, when notifications happen, when the audio occurs. The logic we have now was pretty much hacked in to get BackChannel running (AFAIK). That logic is really brittle, akin to the "scroll to the bottom of the window on new message, even if you've intentionally scrolled back up" bug.
We should solve these in conjunction, I feel like, to handle:
-
You join a chat and there are new messages. Without registered accounts, that's all messages. In the case where you have a registered account, that's all messages you haven't read yet. Audio plays once.
-
You're connected to a chat and someone pings you directly, via your @username. If the leapchat window is current tab, you hear the audio, but no notification. If the leapchat window is not current tab, you hear audio and get a notification.
I'm not sure what the optimal UX is. Overall what we design to handle this notification / audio logic should be easily tweakable. (Yes, this comes from the school of "No Duh", but helps to spell things out. :)
@MartyTheeMartian I like how Mattermost handles notifications, which probably uses https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API