codeforamerica / openbus-api

http://api.chab.us
ISC License
17 stars 6 forks source link

Initial connection gives most recent locations of active buses. #6

Closed acedrew closed 10 years ago

acedrew commented 10 years ago

Store locations of buses in a temporary list by bus ID, when connecting, pass all that have been active within n seconds to the connecting client.

I am stupid. Still stupid, but, there is an issue here, there doesn't seem to be any expiration of buses that are passed by http://api.chab.us/buses, or if there is, it's too long.

junosuarez commented 10 years ago

I'm having some trouble figuring out what your issue is :) I'll attempt to explain what's going on with the two endpoints:

/buses is a static JSON response with the latest information from CARTA. Unfortunately, there's no indication of a timestamp for when information was last received from the bus. The buses which show up on here should all be currently active, as far as I can tell from the data source. Throughout the day, buses will be added and removed from this list automatically.

/buses/tail is a server-sent events stream with three types of events:

acedrew commented 10 years ago

I think it's simply an issue with CARTA's API, active for them does not necessarily mean being driven currently, more along the lines of "In rotation for the route"