ShotgunJed Posted July 15, 2017 Share Posted July 15, 2017 How would one get the closest server to the user in HTML? For example, given three servers, US East, US West and Europe, if someone was in the UK, how would the server or client figure this out and "route" them to the EU server? (It doesn't need to actually route, I just need some variable e.g: bestServer = 'EU'). Also it doesn't have to be the closest server, it should be the one that gives the player the best performance. I am also using Node.js on my backend. Zenext 1 Quote Link to comment Share on other sites More sharing options...
Raggar Posted July 15, 2017 Share Posted July 15, 2017 If you don't need to ping the server and get the latency that way, you could simply use one of the Many geolocation services or libraries. Quote Link to comment Share on other sites More sharing options...
ForgeableSum Posted July 16, 2017 Share Posted July 16, 2017 What Raggar said will work - ping every server and have the player join the one with the lowest ping. It really doesn't need to be more complicated than that. If you want to get the actual location, you can do so from the IP address. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.