Page 1 of 1

Geo Location

Posted: 10 Jun 2013, 01:15
by noveltysoft
Hi, is there any way I can capture Geo Location using API? I saw the Admin portal shows the Geo location. But I need to show it in User's Profile in my Game. Is there any way I can get the Geo Location from SFS API? If yes, then please let me know the details.

Thanks,
William

Re: Geo Location

Posted: 10 Jun 2013, 10:25
by Lapo
We have recently included geolocation services for our Analytics product.
So yes, it might be possible in the future to use that as well for other users at runtime, we will think about it.

At the moment the best way to implement it is to ask or auto-detect the country at registration time and store it in the user's database.
When the user is logged in the system you can add his country name or image-url to the user's variables.

In general the detection at sign up time is better than running a runtime check every time.

Hope it helps

Re: Geo Location

Posted: 19 Sep 2016, 06:56
by foxboy
Hi Lapo,

Is GeoLocation available now on the new SFS version (2.11)?

I need a way to get the user's Country Code based on the user' IP upon initial login, then I want to store in on the database for next login.

Re: Geo Location

Posted: 19 Sep 2016, 09:04
by Lapo
Hi,
officially no, but there's a way to access the analytics geolocation API. I am going to write a brief "recipe" in our blog and post the link here later.

cheers

Re: Geo Location

Posted: 19 Sep 2016, 09:33
by Lapo
Here it is the recipe for geolocation:
http://smartfoxserver.com/blog/using-th ... ation-api/

Hope it helps

Re: Geo Location

Posted: 19 Sep 2016, 09:57
by foxboy
Thanks Lapo. This is awesome!

Just some questions though:

1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers? If so, do I need to update that data file by downloading latest version from Maxmind?

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?

Re: Geo Location

Posted: 19 Sep 2016, 10:46
by Lapo
foxboy wrote:1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers?

We use the local DB, not HTTP calls as it would be too slow.

If so, do I need to update that data file by downloading latest version from Maxmind?

This is a little tricky. Normally yes, but there's a caveat:
SFS2X 2.11.x still uses what they refer to as the "legacy" version --> http://dev.maxmind.com/geoip/legacy/geolite/

This is because recently they have introduced a new version of the geolocation service which we'll integrate in the next 2.12

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?[/quote]
Yes, absolutely.

Re: Geo Location

Posted: 23 Apr 2021, 11:50
by ArnouSolitary
Lapo wrote:
foxboy wrote:1) This is using Maxmind's GeoIP location service, is the database maintained by the SFS instance on the machine or it sends a HTTP request to Maxmind's servers?

We use the local DB, not HTTP calls as it would be too slow.

If so, do I need to update that data file by downloading latest version from Maxmind?

This is a little tricky. Normally yes, but there's a caveat:
SFS2X 2.11.x still uses what they refer to as the "legacy" version --> http://dev.maxmind.com/geoip/legacy/geolite/

This is because recently they have introduced a new version of the geolocation service which we'll integrate in the next 2.12

2) Will this still work if the user is connecting from a WebGL app via secure websocket (WSS)?

How can i access user's city , region , longitude and latitude? [/quote]

Re: Geo Location

Posted: 23 Apr 2021, 14:52
by Lapo
Hi,
the geo location database we include in SFS2X only provides the country (code and name). For extra details such as the city name or coordinates you may need to look into a dedicated service.

Cheers