Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to the MQTT-backed transport #81

Open
roata opened this issue Nov 7, 2019 · 5 comments
Open

Switch to the MQTT-backed transport #81

roata opened this issue Nov 7, 2019 · 5 comments
Milestone

Comments

@roata
Copy link
Member

roata commented Nov 7, 2019

Currently we use an API that was not documented officially, the one that runs on top of WebSTOMP. The new API, documented in api-documentation is using MQTT and is more reliable (it runs on a separate server, and it works even when RabbitMQ is down).

The payload formats are the same, and the subscription logic is the same too.

What is different:

  • what AMQP calls "routing key" is a "topic" in MQTT
  • AMQP uses . separators, MQTT uses slashes /
  • thus transport.telemetry.* becomes transport/telemetry/*
@roata roata added this to the 3.0 milestone Nov 7, 2019
@iamandrewluca
Copy link
Member

iamandrewluca commented Nov 8, 2019

Can we get state.station from MQTT ?

For station panels we can split frontend, and use webstomp.

@roata
Copy link
Member Author

roata commented Nov 8, 2019

Hmm, at the moment it is not available over MQTT. I will make it happen and write about it tonight.

Note, however, that this feature request is for milestone 3.0, so - in the future. At the moment our top priorities are route-multi-subscription and the performance issues #76. It is getting unusable on my phone, and sometimes even on my computer.

@roata
Copy link
Member Author

roata commented Dec 27, 2019

@iamandrewluca, I forgot about this, but stumbled upon it today. The ETAs are now exposed to the public via MQTT as well, here's how it works: mosquitto_sub -h opendata.dekart.com -p 1945 -t state/infopanel/+

Payload example:

{"route": 30, "station": "Aeroport - pornire", "time": "2"}
  • the MQTT topic will contain the bus station ID (we'll have to make a dictionary of those, like in vehicles.csv and routes.csv)
  • route - human-readable route name (not route_upstream_id! - this might have to be reconsidered), the ETA for which is sent
  • station - human readable name of the station, might be removed in the future, once we have a dictionary of station IDs and names
  • time - the time, in minutes, until the next vehicle of the given route will arrive to this station.

The format is a draft and will be changed, based on feedback. The payloads may contain other elements - don't count on those.

@roata
Copy link
Member Author

roata commented Dec 28, 2020

This could be relevant, since the bus telemetry also uses MQTT: roataway/gtfs-data#5

@iamandrewluca
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants