Esri's Geotrigger Service is replacing Geoloqi! Learn More | FAQ

Streaming

Contents

Overview

Geoloqi provides a real-time streaming service through Websockets and Socket.IO.

Groups

You can subscribe to the location updates for all users in a group by connecting to the streaming server and listening to the group token.

Implementing this on a web browser is very simple using the Geoloqi Javascript SDK. In this example, we subscribe to a group token, and then write updates to the console:

<script type="text/javascript" src="https://subscribe.geoloqi.com/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://api.geoloqi.com/js/geoloqi.min.js"></script>
 
<script>
  window.onload = function () {
    var group = new geoloqi.Socket('group', 'YOUR_GROUP_TOKEN');
 
    group.events.location = function(location) {
      console.log(location);
    }
 
    group.events.disconnect = function() {
      console.log('group socket disconnected');
    }
 
    group.start();
  }
</script>

Location Sharing

When users are sharing their location with a share token, you can use that token to see their position in real time, same as with groups. The following example will return live data without modification, "TQ4ew3Z" is a permanent trip token for our test account:

<script type="text/javascript" src="https://subscribe.geoloqi.com/socket.io/socket.io.js"></script>
<script type="text/javascript" src="http://api.geoloqi.com/js/geoloqi.min.js"></script>
 
<script>
  window.onload = function () {
    var trip = new geoloqi.Socket('trip', 'TQ4ew3Z');
 
    trip.events.location = function(location) {
      console.log(location);
    }
 
    trip.events.disconnect = function() {
      console.log('trip socket disconnected');
    }
 
    trip.start();
  }
</script>

Showing position on a map

There are more demos in our geoloqi-js repository that show how you can update a user's location using Google Maps. The procedure should be very similar with Leaflet and other mapping services.