-
Notifications
You must be signed in to change notification settings - Fork 1
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
Method to check connectivity #15
Comments
Great idea! Networking features is definitely something I want to look into. Especially smaller functions like this which can be used from checking leaderboards to multiplayer sessions. I can think of two ways of implementing this. Either as an AJAX request or using the neat Unless you had other possible solutions to this? |
I did some brief testing and found the online/offline events are not super reliable. Perhaps we can use a combination of the two. Regarding the AJAX call, it could be to a URL on the Convergame GitHub pages site that just returned a basic text file. We can then check if there is a HTTP 200 response or not. |
I'd go with a mix of both 👍 Ideally you'd want to check something that's known for reliability. |
I'll take a stab at integrating this functionality if I get the time tonight. |
One solution would be to use Web Sockets, as it's supported fairly well in modern browsers. Maybe doing something fairly straight forward like this. Where if there isn't any issues connecting then simply return true. Else return the error message so that the issue can be debugged via console.log(), etc. Thoughts??? |
@ojdon Where would this test web socket connection connect to? |
It goes to the WebSockets Echo Service |
Are they happy for 3rd parties to use that service? It is not obvious from the site. |
Am I online or offline?
The text was updated successfully, but these errors were encountered: