Geolocation

The Geolocation service provides the current location of the client based on its IP address.

Upon receipt of a location request message from the client, the Geolocation service queries http://www.hostip.info to get the current location, based on the client's IP address. The correctness of the result depends on the contents of the database that hostip.info provides. If the client's IP isn't in the database, an incorrect location might be returned.

Client queries about location information can be made using the following PPS command:
(exec 3<>/pps/services/geolocation/control?wait &&
echo 'msg::location\nid::test\ndat:json:
{"period":5.0,"provider":"network","fix_type":"wifi"}' >&3 &&
cat <&3)
where:
The Geolocation service responds to the client in the following format in the control object:
@control 
res::location 
id::test 
dat:json:{"accuracy":60,"latitude":45.3333,"longitude":-75.9}

The browser also uses the Geolocation service to query the location as shown above. The Geolocation service is multithreaded and can handle requests from multiple clients at the same time.

PPS objects:

For more information about the PPS objects that the Geolocation service uses, see these entries in the PPS Objects Reference: