linxio-js

Realtime

Receive Linxio live coordinates and notification messages over Socket.IO.

Linxio documents two Socket.IO namespaces:

  • coordinates
  • notifications

Coordinates

const unsubscribe = linxio.realtime.onPosition([304, 305], (position) => {
  console.log(position.vehicleId, position.lat, position.lng);
});

// Later
unsubscribe();

The SDK resubscribes on reconnect.

Notifications

const stop = linxio.realtime.onNotification((notification) => {
  console.log(notification.type, notification.message);
});

Manual subscription

await linxio.realtime.subscribe([304], "coordinates");

Cleanup

linxio.realtime.disconnect();

On this page