Connectors
This page is generated from the Open Location Hub source documentation and should not be edited in the website repository.
This repository keeps connectors outside the hub runtime. A connector is a small process that reads data from some upstream system, maps that data to the hub’s OMLOX-facing model, and submits it through the hub’s supported transport surfaces.
The key point is simple: creating a connector is easy. You do not need to patch the hub. In most cases you only need:
- a small runtime loop that reads upstream data
- some mapping code that builds OMLOX
LocationorProximitypayloads - optional REST bootstrap calls for providers, trackables, zones, or fences
- a transport publisher for WebSocket or MQTT
Bundled Connector Examples
The repository already includes a few connector-oriented projects under
connectors/:
connectors/gtfs/README.md: GTFS-RT vehicle ingest plus station-zone and fence bootstrapconnectors/opensky/README.md: OpenSky aircraft ingest plus airport fence bootstrapconnectors/replay/README.md: NDJSON trace replay back into the hub for diagnostic or demo use
The bundled runtime connectors now cover both transport styles. The GTFS project includes WebSocket and MQTT ingest variants, and the OpenSky project shows the WebSocket path. Together they are useful examples for connector structure, env handling, bootstrap logic, and local development flow.
The recommended local runtime itself now lives outside connectors/ under
local-hub/README.md
because it is broader than connector bootstrapping. It is the normal starting
point when you want a local hub plus observability stack on your laptop.
Easy Path
Most custom connectors follow the same shape:
- Pick a transport. Use WebSocket when you want the simplest general-purpose hub-facing ingest path. Use MQTT when your deployment already centers on a broker or trusted edge adapters.
- Prepare env-driven config. Keep hub URLs, broker settings, auth tokens, upstream URLs, and poll intervals in environment variables.
- Create or reconcile hub metadata when needed.
Many connectors need a
LocationProviderand sometimesTrackable,Zone, orFenceresources before live ingest starts. - Map upstream records to OMLOX payloads.
Normalize each upstream event to a hub payload such as
LocationorProximity. - Publish to the hub. Send those normalized payloads over WebSocket or MQTT using the transport’s expected wrapper or topic layout.
- Run locally against the shared demo stack.
Use
local-hub/README.mdfor a reproducible local hub, Postgres, Dex, Mosquitto, and optional SigNoz environment.
Shared Connector Shape
The bundled connectors show a practical split that is easy to copy:
- one runtime script that polls or subscribes to the upstream source
- one small client helper module for hub REST and transport calls
- optional bootstrap scripts for zones, fences, or other metadata
- simple env-file loading so the connector can run locally or in a container
The shared flow looks like this:
- Load env-driven configuration.
- Connect to the hub transport surface.
- Ensure the provider exists through REST.
- Optionally upsert trackables or bootstrap fences and zones.
- Read upstream data.
- Map it to OMLOX payloads.
- Publish the payloads.
- Retry or reconnect when the upstream source or hub transport fails.
Running A Connector Locally
The recommended local development path is the shared demo runtime:
- Start the local stack:
local-hub/start_demo.sh
- If auth is enabled, fetch a token:
local-hub/fetch_demo_token.sh
- Create a connector-local env file with the hub URLs, optional token, and any upstream-specific settings.
- Run the connector process.
The bundled demos use HUB_HTTP_URL for REST bootstrap work and HUB_WS_URL
for WebSocket ingest. MQTT-based connectors would typically use HUB_HTTP_URL
plus MQTT_BROKER_URL or equivalent broker settings.
Choosing A Transport
- docs/connectors-websocket.md is the best starting point if you want the same transport flow as the bundled runtime connectors.
- docs/connectors-mqtt.md explains how to build the same kind of connector on top of the hub’s OMLOX MQTT surface.
Where To Copy From
If you want a fast starting point:
- copy the project structure and env handling style from
connectors/gtfs/README.mdorconnectors/opensky/README.md - use
local-hub/README.mdas the local runtime guide - use
specifications/omlox/websocket.mdorspecifications/omlox/mqtt.mdas the transport source of truth
That is usually enough to get a first connector running quickly.