Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Chrome browser notifications when high score is beat #9

Closed
Sageth opened this issue Sep 29, 2017 · 5 comments
Closed

Implement Chrome browser notifications when high score is beat #9

Sageth opened this issue Sep 29, 2017 · 5 comments

Comments

@Sageth
Copy link
Owner

Sageth commented Sep 29, 2017

If player A has the high score and player B beats the score, Player A should get a browser notification that their score was beaten.

@MisterBrownRSA
Copy link

@Sageth Wouldn't this need to be done using sockets ? I'm curious, because otherwise you'd have to poll with AJAX...

@Sageth
Copy link
Owner Author

Sageth commented Sep 29, 2017

I haven't looked too deeply into it, other than cursory looks:
https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API
https://developers.google.com/web/fundamentals/push-notifications/display-a-notification

At a glance, this looks like it's an API call, but like I said, I haven't looked too deeply into it, so it may be much more involved than I initially thought.

@MisterBrownRSA
Copy link

@Sageth Yes, this is only the type of notification that can be sent.

Typically when handling notifications it's either caller event based, eg. clicked on this button, show a notification.
or
It's socket event based where the back-end software will broadcast an event through something like pusher which the front end will be listening for - which then pushes the notification.

So what you're actually looking for here, is whether or not you're willing to have the user refresh the page in order to get the notification, or will the notification be pushed "real time". I'll run through the code and see if you aren't already using some sort of socket that I can just connect to.

@Sageth
Copy link
Owner Author

Sageth commented Sep 30, 2017

Thanks for the clarification. I had envisioned the event occurring during score submit process, which should only occur with those types of games. The score submission should occur here: https://github.com/Sageth/phparcade/blob/master/includes/classes/Scores.php#L53

This is an old codebase (PHP4, or possibly earlier) that I've spent a lot of time modernizing as part of my own learning, so I know the socket_ functions aren't used anywhere. I do appreciate the insight on this, though.

@Sageth
Copy link
Owner Author

Sageth commented Jun 18, 2018

I've since decided to use Discord for notifications due to the feature set. This was implemented in fb44d46 and have had a number of bug fixes to address some specific scenarios since implementation. Closing issue.

@Sageth Sageth closed this as completed Jun 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants