docker run -d -p 8000:8000 oopjot/tracker
Information about lines X, Y and Z are served via websocket
ws://0.0.0.0:8000/vehicles?lines=X,Y,Z
To test it, just reach the endpoint with ws tool (e. g. wscat).
wscat -c "ws://0.0.0.0:8000/vehicles?lines=10,100,111"
Then, JSON is emmited.
type Vehicle struct {
DataGenerated string
Line string
Route string
VehicleCode string
VehicleService string
Id int
Speed: int
Delay int
Lat float64
Lon float64
GpsQuality int
B float64
}
B is a calculated bearing angle.
- emit batch of data on connection
- move port number to some config file, or use env variable
- integrate other APIs