live stock update
This commit is contained in:
@@ -76,6 +76,7 @@ func RegisterPosRoutes(api fiber.Router, f *facade.Facade) {
|
||||
|
||||
registerPosStaffConsoleRoutes(api, f)
|
||||
registerPosReadConsoleRoutes(api, f)
|
||||
registerLiveRoutes(api, f)
|
||||
}
|
||||
|
||||
// The same counter-sales reads, for callers that are not a terminal.
|
||||
@@ -157,3 +158,18 @@ func registerPosStaffConsoleRoutes(api fiber.Router, f *facade.Facade) {
|
||||
g.Put("/updatestaffshift", f.PosController.WebUpdateStaffShift)
|
||||
}
|
||||
}
|
||||
|
||||
// The console's live event stream.
|
||||
//
|
||||
// Separate from the POS groups above because the caller is the back office,
|
||||
// not a terminal, and because it is the one route here that holds a
|
||||
// connection open — worth being obvious about when reading the route table.
|
||||
//
|
||||
// `/events` is Server-Sent Events and never returns until the client goes
|
||||
// away or the age limit fires. `/events/health` is an ordinary JSON read that
|
||||
// says how many consoles are attached to THIS replica.
|
||||
func registerLiveRoutes(api fiber.Router, f *facade.Facade) {
|
||||
g := api.Group("/v1/web/live")
|
||||
g.Get("/events", f.LiveController.Stream)
|
||||
g.Get("/events/health", f.LiveController.Health)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user