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

Method to check connectivity #15

Open
jbrooksuk opened this issue Sep 15, 2015 · 8 comments
Open

Method to check connectivity #15

jbrooksuk opened this issue Sep 15, 2015 · 8 comments
Assignees
Milestone

Comments

@jbrooksuk
Copy link
Contributor

Am I online or offline?

@ojdon
Copy link
Member

ojdon commented Sep 15, 2015

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 navigator.onLine attribute as it's becoming supported rather well, as shown here. Read also the spec and a demo.

Unless you had other possible solutions to this?

@DivineOmega
Copy link
Collaborator

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.

@jbrooksuk
Copy link
Contributor Author

I'd go with a mix of both 👍

Ideally you'd want to check something that's known for reliability.

@ojdon
Copy link
Member

ojdon commented Sep 17, 2015

I'll take a stab at integrating this functionality if I get the time tonight.

@ojdon ojdon self-assigned this Sep 17, 2015
@ojdon
Copy link
Member

ojdon commented Sep 17, 2015

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???

@DivineOmega
Copy link
Collaborator

@ojdon Where would this test web socket connection connect to?

@ojdon
Copy link
Member

ojdon commented Sep 19, 2015

It goes to the WebSockets Echo Service

@DivineOmega
Copy link
Collaborator

Are they happy for 3rd parties to use that service? It is not obvious from the site.

@ojdon ojdon added this to the 0.2 Release milestone Oct 18, 2015
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

3 participants