or Browser Notifications
  • 11 posts
  • Page 1 of 1
Munvo wrote:
Would be super useful for those who do not watch their email to have the option of using web push notifications for letting them know their next turn is up for long term games.
Cireon wrote:
This has been on my "want to do" list for a long time, and with some of the recent code rewrites I've been doing, maybe this is something we can support in the future. The hardest thing will be making sure we don't send the notification multiple times if you have multiple tabs open.

If I may ask though, what kind of notifications would you like to get?
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
dough_boy wrote:
So using the Styler extension I have a JS function that polls the open tab and will change the "title" of the tab to the number of current turns.

This way I can have the tab open and see when a turn happens.

Cireon you could do it in a similar fashion and when the tab is open and there are new turns update the title for the tab.
Munvo wrote:
Simple and short text based notification with the name of this site and that it is my turn would be the most useful notification.
Cireon wrote:
dough_boy, that's a good idea, we could build a system that changes the tab title using the number of available turns. I think in some browsers that will even trigger some form of "nudge" that you know something is changed. One problem though is that our tabs don't generally update in the background. If we don't detect any activity for 30 seconds, we stop polling the server for new turns. This is to prevent people with lots of open tabs causing a bunch of requests to the server without them being needed. It's not a perfect system, but it is what it is. For these tab titles to be successful, we'd need to start polling the server even if a tab is inactive, which is hard to justify with the server loads we're seeing right now. We're hoping to switch to a push system at some point which would alleviate some of this, but that's a far future thing.

Munvo, do you mean when you have the page for a specific game open, or do you want a notification even if you are not currently looking at the game in that tab? One of my concerns here is that if we start sending push notifications, people might be tempted to not pay attention to the games when it's their turn. Then when they come back, they first need to look at the entire board, devise a strategy, figure out what happened, etc. I am not sure if that is promoting good strategy. Would love to hear what other people think about this though. We already have the sounds, so maybe it's not as big of a deal as I am thinking.
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
dough_boy wrote:
How about instead of stopping for 30 seconds it progressively lengthens. Sort of like Gmail when it cannot connect it says trying in 60 seconds, next time it says 3 minutes, 5 minutes, etc. So...

30
30
60
120
180
240
300

This would be 7 polls in 16 minutes. Once the person is determined to be active (interacts with the page) it starts over again. You could even get crazy and add a token on each page load so if the server detected that a user had simultaneous polling from more than one tab only the first would work. Using document.visibilityState you could write other logic on how frequently (or not) you want to poll when the tab is in the background.
Cireon wrote:
Yup. I agree we could change this. The question is: is this really the most important way we can spend our programming time?
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
Munvo wrote:
Cireon, this would be most applicable to long term games. I couldn't see this being very valuable to live games where the turn length is so short that you are by the very nature of the game required to maintain attention. I've found in the few long term games I'm getting into that I have to keep checking back to see if it is my turn.

I see the experience being something akin to starting a long term game. Either being asked if I want to turn on browser notifications (built-in popup asking permission) or having to click a button on the website to solicit this permission (ultimately required.) I likely have to wait for my turn to come around so I depart from the website (saving valuable resources.) A few hours later I get a popup advising me that my turn is either next or up and I head on over to game via the notification. Check out the game and make my turn. Timing wise it would be similar to the email option for a notification just a more modern option.

I think this is a simple feature to add given the notification functionality already exists for this type of message and is a rare but actually reasonable use of the technology.

Coding wise, I'm not sure what languages you are using on here but I assume PHP and there seem to be a lot of useful resources online that would help make implementing this type of feature a lot easier.
Cireon wrote:
For long term games, gotcha.

It would require you to keep the website open in a tab, but other than that, we could implement it if we made sure we woke up the tab every few minutes to check for new turns. Not sure when it'll come, but I like the idea and would like to add it.
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
Cireon wrote:
Actually I found a way where we don't have to keep refreshing the page and can send notifications without having to keep the site open. I'll do some investigation to see which browsers are supported and report back when I know more.
“This is how humans are: We question all our beliefs, except for the ones that we really believe in, and those we never think to question.”
- Speaker for the Dead, O.S. Card
Munvo wrote:
Exactly. The benefit being it would work even when the website was not open on the user's browser.

Looks like you can either compile your own version, use an open source version, or use a pre-made API with someone else accepting handling the transmission in return for the ability to collect data on users.

Free up to 60k: https://www.webpushr.com

Open source, just to name a few places to look: