{"componentChunkName":"component---src-templates-developers-js","path":"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/","result":{"data":{"childPages":{"edges":[{"node":{"fields":{"slug":"/en/developers/"},"frontmatter":{"title":"For developers","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/"},"frontmatter":{"title":"System architecture","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/api-registration/"},"frontmatter":{"title":"API portal and registration","order":-12,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/changes/"},"frontmatter":{"title":"Changes","order":-10,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/user-interfaces/"},"frontmatter":{"title":"User interfaces","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/deprecations/"},"frontmatter":{"title":"Deprecations","order":-11,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/docker-guide/"},"frontmatter":{"title":"Docker guide","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/"},"frontmatter":{"title":"APIs","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/"},"frontmatter":{"title":"Routing API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/2-routing-data-api/"},"frontmatter":{"title":"Routing data API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/4-map-api/"},"frontmatter":{"title":"Map API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/"},"frontmatter":{"title":"API architecture","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/6-api-faq/"},"frontmatter":{"title":"FAQ","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/"},"frontmatter":{"title":"Realtime APIs","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/3-geocoding-api/"},"frontmatter":{"title":"Geocoding API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/7-terms-of-use/"},"frontmatter":{"title":"Terms of use","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/user-interfaces/1-digitransit-ui/"},"frontmatter":{"title":"Digitransit-ui","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/0-graphql/"},"frontmatter":{"title":"GraphQL","order":10,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/3-realtime-information/"},"frontmatter":{"title":"Real-time information","order":40,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/2-glossary/"},"frontmatter":{"title":"Glossary","order":30,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/canceled-trips/"},"frontmatter":{"title":"Canceled trips","order":80,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/disruption-info/"},"frontmatter":{"title":"Disruption info","order":70,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/4-translations/"},"frontmatter":{"title":"Translation","order":50,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/routes/"},"frontmatter":{"title":"Routes","order":100,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/stops/"},"frontmatter":{"title":"Stops","order":110,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/bicycles-scooters-cars/"},"frontmatter":{"title":"Bicycles, cars and e-scooters","order":60,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/itinerary-planning/"},"frontmatter":{"title":"Itinerary planning","order":90,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/1-routing-api/"},"frontmatter":{"title":"Routing API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/2-routing-data-api/"},"frontmatter":{"title":"Routing Data","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/4-map-api/"},"frontmatter":{"title":"Map API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/5-realtime-api/"},"frontmatter":{"title":"Real-time APIs","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/3-geocoding-api/"},"frontmatter":{"title":"Geocoding API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/1-routing-api/1-graphiql/"},"frontmatter":{"title":"GraphiQL","order":20,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/4-map-api/background-map/"},"frontmatter":{"title":"Background map","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/1-getting-started/"},"frontmatter":{"title":"Getting started","order":10,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/3-geocoding-api/address-search/"},"frontmatter":{"title":"Address search","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/3-geocoding-api/autocomplete/"},"frontmatter":{"title":"Autocomplete","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/trip-updates/"},"frontmatter":{"title":"Trip updates","order":30,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/service-alerts/"},"frontmatter":{"title":"Service alerts","order":20,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/3-geocoding-api/address-lookup/"},"frontmatter":{"title":"Address lookup","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/4-map-api/pois/"},"frontmatter":{"title":"Points of interest","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/vehicle-positions/"},"frontmatter":{"title":"Vehicle positions","order":40,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/3-geocoding-api/data-container/"},"frontmatter":{"title":"Data builder and container","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/architecture/x-apis/3-geocoding-api/api/"},"frontmatter":{"title":"API","order":null,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/vehicle-positions/high-frequency-positioning/"},"frontmatter":{"title":"High-frequency positioning","order":20,"redirect":null}}},{"node":{"fields":{"slug":"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/"},"frontmatter":{"title":"Digitransit MQTT broker","order":10,"redirect":null}}}]},"markdownRemark":{"fields":{"slug":"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/"},"frontmatter":{"title":"Digitransit MQTT broker","redirect":null,"toc":null,"description":null,"assets":null,"technologies":null,"docker":null},"html":"<h2 id=\"available-endpoints\" style=\"position:relative;\"><a href=\"#available-endpoints\" aria-label=\"available endpoints permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Available endpoints</h2>\n<p>The URL of the MQTT broker is mqtt.digitransit.fi. It has support for the protocols (using standard port numbers) listed below:</p>\n<table>\n<thead>\n<tr>\n<th>Protocol</th>\n<th>Port</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>MQTT with TLS (mqtts://)</td>\n<td>8883</td>\n</tr>\n<tr>\n<td>MQTT       (mqtt://)</td>\n<td>1883</td>\n</tr>\n<tr>\n<td>MQTT over secure web socket (wss://)</td>\n<td>433</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"topic-structure\" style=\"position:relative;\"><a href=\"#topic-structure\" aria-label=\"topic structure permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Topic Structure</h2>\n<div class=\"gatsby-highlight\" data-language=\"text\"><pre class=\"language-text\"><code class=\"language-text\">/&lt;feed_format>/&lt;type>/&lt;feed_id>/&lt;agency_id>/&lt;agency_name>/&lt;mode>/&lt;route_id>/&lt;direction_id>/&lt;trip_headsign>/&lt;trip_id>/&lt;next_stop>/&lt;start_time>/&lt;vehicle_id>/&lt;geohash_head>/&lt;geohash_firstdeg>/&lt;geohash_seconddeg>/&lt;geohash_thirddeg>/&lt;short_name>/&lt;color>/</code></pre></div>\n<table>\n<thead>\n<tr>\n<th>Topic level</th>\n<th>Description</th>\n<th>Possible values</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>feed_format</td>\n<td>Feed format</td>\n<td>gtfsrt</td>\n</tr>\n<tr>\n<td>type</td>\n<td>Type of the feed</td>\n<td>vp</td>\n</tr>\n<tr>\n<td>feed_id</td>\n<td>GTFS feed ID</td>\n<td><a href=\"#available-cities-and-regions\">Listed here</a></td>\n</tr>\n<tr>\n<td>agency_id</td>\n<td>GTFS agency ID</td>\n<td>Not implemented yet but will be any string or empty</td>\n</tr>\n<tr>\n<td>agency_name</td>\n<td>GTFS agency name</td>\n<td>Not implemented yet but will be any string or empty</td>\n</tr>\n<tr>\n<td>mode</td>\n<td>Transport mode</td>\n<td>BUS, FERRY, FUNICULAR, RAIL, TRAM or empty (there might be more possible values in the future)</td>\n</tr>\n<tr>\n<td>route_id</td>\n<td>GTFS route ID</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>direction_id</td>\n<td>GTFS direction ID</td>\n<td>0, 1 or empty</td>\n</tr>\n<tr>\n<td>trip_headsign</td>\n<td>GTFS trip headsign</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>trip_id</td>\n<td>GTFS trip ID</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>next_stop</td>\n<td>Next (or current) stop ID</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>start_time</td>\n<td>The scheduled start time of the trip</td>\n<td>can be 25:30 for example, or empty</td>\n</tr>\n<tr>\n<td>vehicle_id</td>\n<td>GTFS vehicle ID</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>geohash_head</td>\n<td><a href=\"#geohash\">The whole numbers of a simplified geohash</a></td>\n<td>lat;lon, for example <code class=\"language-text\">60;24</code></td>\n</tr>\n<tr>\n<td>geohash_firstdeg</td>\n<td><a href=\"#geohash\">The first decimal place from lat and lon</a></td>\n<td>latlon, for example <code class=\"language-text\">17</code></td>\n</tr>\n<tr>\n<td>geohash_seconddeg</td>\n<td><a href=\"#geohash\">The second decimal place from lat and lon</a></td>\n<td>latlon, for example <code class=\"language-text\">28</code></td>\n</tr>\n<tr>\n<td>geohash_thirddeg</td>\n<td><a href=\"#geohash\">The third decimal place from lat and lon</a></td>\n<td>latlon, for example <code class=\"language-text\">39</code></td>\n</tr>\n<tr>\n<td>short_name</td>\n<td>Short name of the route</td>\n<td>Any string or empty</td>\n</tr>\n<tr>\n<td>color</td>\n<td>Color of the route</td>\n<td>A color encoded as a six-digit hexadecimal number (the leading \"#\" is not included) such as <code class=\"language-text\">FFFFFF</code> or empty</td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"message-structure\" style=\"position:relative;\"><a href=\"#message-structure\" aria-label=\"message structure permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Message Structure</h2>\n<p>The messages are protobuf encoded GTFS realtime messages each containing information about one vehicle. There might be small differences in what data is included in a message depending on the feed ID as the data comes from different systems. <a href=\"https://developers.google.com/transit/gtfs-realtime/examples/code-samples\">Here are some examples on how to decode the GTFS realtime data in code.</a></p>\n<h2 id=\"available-cities-and-regions\" style=\"position:relative;\"><a href=\"#available-cities-and-regions\" aria-label=\"available cities and regions permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Available cities and regions</h2>\n<p>This list contains cities or regions for which there is vehicle position data available through the MQTT broker. The listed feed IDs match the ones used in the topic structure. To fetch more relevant information about, for example, the vehicles' trips, one can use the listed GTFS data or the routing endpoint (<a href=\"../../../1-routing-api/\">which are documented here</a>). <b>Note, <a href=\"../../../../api-registration/\">subscription keys</a> need to used when downloading GTFS data</b>.</p>\n<p><b>This is list might not always be up-to-date and new data sources are constantly included.</b></p>\n<table>\n<thead>\n<tr>\n<th>City/region</th>\n<th>Feed ID and link to GTFS URL</th>\n<th>Routing endpoint</th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>Tampere</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/tampere-gtfs.zip\">tampere</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Jyväskylä</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/LINKKI-gtfs.zip\">LINKKI</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Lappeenranta</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Lappeenranta-gtfs.zip\">Lappeenranta</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Joensuu</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Joensuu-gtfs.zip\">Joensuu</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Kuopio</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Kuopio-gtfs.zip\">Kuopio</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Turku</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/FOLI-gtfs.zip\">FOLI</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Oulu</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/OULU-gtfs.zip\">OULU</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Hämeenlinna</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Hameenlinna-gtfs.zip\">Hameenlinna</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Lahti</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Lahti-gtfs.zip\">Lahti</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Vaasa</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Vaasa-gtfs.zip\">Vaasa</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Mikkeli</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Mikkeli-gtfs.zip\">Mikkeli</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Pori</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Pori-gtfs.zip\">Pori</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Kouvola</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Kouvola-gtfs.zip\">Kouvola</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Kotka</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Kotka-gtfs.zip\">Kotka</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Rovaniemi</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Rovaniemi-gtfs.zip\">Rovaniemi</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">waltti</a></td>\n</tr>\n<tr>\n<td>Salo</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Salo-gtfs.zip\">Salo</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>Kajaani</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/waltti/Kajaani-gtfs.zip\">Kajaani</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/waltti/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>VARELY</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/varely/VARELY-gtfs.zip\">VARELY</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/varely/gtfs/v1\">varely</a></td>\n</tr>\n<tr>\n<td>Rauma</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/finland/Rauma-gtfs.zip\">Rauma</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/finland/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>Finland trains</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/finland/digitraffic-gtfs.zip\">digitraffic</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/finland/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>Härmän liikenne</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/finland/Harma-gtfs.zip\">Harma</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/finland/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>Uusimaa ELY Korsisaari</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/finland/Korsisaari-gtfs.zip\">Korsisaari</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/finland/gtfs/v1\">finland</a></td>\n</tr>\n<tr>\n<td>Etelä-Pohjanmaa ELY Ingves &#x26; Svanbäck</td>\n<td><a href=\"https://api.digitransit.fi/routing-data/v3/finland/IngvesSvanback-gtfs.zip\">IngvesSvanback</a></td>\n<td><a href=\"https://api.digitransit.fi/routing/v2/finland/gtfs/v1\">finland</a></td>\n</tr>\n</tbody>\n</table>\n<h2 id=\"geohash\" style=\"position:relative;\"><a href=\"#geohash\" aria-label=\"geohash permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Geohash</h2>\n<p>The topic structure includes a form of geohash for the latitude and the longitude of the vehicle. The digits of the integer parts are separated into their own level, <code class=\"language-text\">geohash_head</code>, in the format <code class=\"language-text\">&lt;lat>;&lt;long></code>, e.g. <code class=\"language-text\">60;24</code>. The digits of the fractional parts are split and interleaved into a custom format so that e.g. (60.123, 24.789) becomes <code class=\"language-text\">60;24/17/28/39</code>. This format enables subscribing to specific geographic boundaries easily.</p>\n<h2 id=\"best-practices\" style=\"position:relative;\"><a href=\"#best-practices\" aria-label=\"best practices permalink\" class=\"anchor before\"><svg aria-hidden=\"true\" focusable=\"false\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>Best practices</h2>\n<p>Fetching everything (especially when it's not needed) through the broker is not recommended. One of the best things about MQTT is the possibility to limit what is fetched through subscriptions by specifying the interesting things in the topic. Instead of fetching information about all vehicles, for example, subscribing to a topic like <code class=\"language-text\">/gtfsrt/vp/tampere/+/+/+/5/+/Keskustori/#</code> will result to only receiving information about vehicles on Tampere's route with the short name <code class=\"language-text\">5</code> and trip headsign of <code class=\"language-text\">Keskustori</code>.</p>\n<p>Additionally, to help separate different clients, it's recommended to include a random string at the end of the client ID. Also, keepalive interval should be configured to be less than a minute (for example 30 seconds) and retrying of connection should not be done every second but instead every 30 seconds, for example.</p>","tableOfContents":"<ul>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#available-endpoints\">Available endpoints</a></li>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#topic-structure\">Topic Structure</a></li>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#message-structure\">Message Structure</a></li>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#available-cities-and-regions\">Available cities and regions</a></li>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#geohash\">Geohash</a></li>\n<li><a href=\"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/#best-practices\">Best practices</a></li>\n</ul>","excerpt":"Available endpoints The URL of the MQTT broker is mqtt.digitransit.fi. It has support for the protocols (using standard port numbers) listed below: Protocol Port MQTT with TLS (mqtts://) 8883 MQTT…"}},"pageContext":{"slug":"/en/developers/apis/5-realtime-api/vehicle-positions/digitransit-mqtt/"}},"staticQueryHashes":["3675773199","4050193485"]}