SSE Message Types
- Single channel with different types of messages:
- Tether — based on a given Outing, the Tether provides a series of LatLon events that tell clients the Guide's position.
- Game Status — Tracks progress along a given Outing.
- Puzzle Status — As Answer Summaries for a given Outing's current puzzle are broadcast, clients are given those events.
- Award Badges — When a badge is awarded, the client is given an opportunity to handle the event and let the user know of the award.
- SSE Supports Subscribers only for Mobile devices (Is this really just for mobile devices? I seem to be having success picking up the events using the browser.)
- SSE supports broadcast requests only from Core server
Design Decisions
- Create separate types of messages and listen for the separate events. (event: customType\n as an example)
- The state can be represented as CONNECTING: Orange, OPEN: Green, CLOSED: Red.
- Use a comment (:Keep Alive as an example) to hold the connection open. This is the true heartbeat — keep alive.
Remaining to be explored:
- Check out the Server Load when multiple clients are subscribing
- Sort out the Life-cycle of when the channels are brought up and shut down.
- Reporting on the Server-side which connections are live (may be part of the API for reporting to the Team page).
- Connectionless Push Notifications — how much of this is built-in already?
Tether (was Heartbeat)
This could be pushed with each position change and then if no new event after a configurable period (20 seconds?), the heartbeat will be sent to confirm connection.
Required Data
- Event Type Heartbeat
- GPS coordinates of Guide (tether)
- Responding to the heartbeat goes back to Connection State on Core Server; absence means loss of connection
Considering the response from clients to confirm the connection is live for each member of the Team (and can be reflected there).
Game State
For a given Outing:
- Confirming Team (Arrival at Start)
- Ready to Roll
- Arrival at next Attraction
Required Data
- Event Type Game State
- Outing ID
- Event Data for Location Change
- Departing or Arriving
- When Departing, upcoming Location ID (this is when the next location is revealed)
- When Arriving, the ID of the location we're arriving at.
Optional Data
- Timestamp
Puzzle State
For the current puzzle on an outing (up to Core Server to know what this is for the outing)
Required Data
- Event Type Puzzle State
- Answer Summaries across team
- Response total per Answer
- Total responses
Diagram
This is for the Game State, but the other two are similar.page revision: 2, last edited: 20 Sep 2019 20:50