-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #551 from LACMTA/practice-changes
Changes for local dev and more documentation
- Loading branch information
Showing
6 changed files
with
89 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# Websockets | ||
|
||
The API has one WebSocket endpoint used to provide a stream of realtime data. The URL is in this format: | ||
|
||
``` | ||
wss://api.metro.net/ws/{agency_id}/{endpoint}/{route_codes (optional)} | ||
``` | ||
|
||
## Parameters | ||
|
||
__agency_id (str)__ | ||
|
||
The agencyID is found in the GTFS-schedule `agency.txt` files. | ||
|
||
Values: | ||
- `LACMTA` (Metro Bus) | ||
- `LACMTA_Rail` (Metro Rail) | ||
|
||
__endpoint (str)__ | ||
|
||
The type of GTFS-realtime data to send. | ||
|
||
Values: | ||
- `vehicle_positions` | ||
- `trip_updates` | ||
|
||
__route_codes (str, optional)__ | ||
|
||
A comma-separated list of route codes to filter updates. If not provided, updates for all routes are sent. | ||
|
||
Route codes are the definitive labels for each of the lines, minus HASTUS version numbers and separated from their "sister" lines. | ||
|
||
## Response | ||
|
||
The WebSocket endpoint sends updates every 3 seconds. | ||
|
||
### Success | ||
|
||
The WebSocket endpoint sends updates in the following format: | ||
|
||
{ | ||
"id": "vehicle_id", | ||
"vehicle": { | ||
"trip": { | ||
"route_id": "route_code", | ||
... | ||
}, | ||
... | ||
}, | ||
"route_code": "route_code", | ||
... | ||
} | ||
|
||
Each message from the WebSocket contains data for a single vehicle. | ||
|
||
### Error | ||
|
||
If an error occurs while processing updates, the WebSocket endpoint sends an error message in the following format: | ||
|
||
"Error: error_message" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters