Functional Overview
What is OSG?
The Onsite Gateway (OSG) is a real-time communication hub that allows us to push instant messages and notifications to users across our sports products while they are actively using our websites and mobile apps.
Think of it as a constant open line of communication (a "WebSocket") between the user's device and our servers. Instead of the app constantly asking "Do I have any new messages?", OSG allows our systems to send a message to the user the very instant it happens.
OSG serves three of our brands: Betfair, Paddy Power, and Sky Betting & Gaming.
Key Capabilities
- Real-time Delivery: Delivers instant "Toast" or full-screen notifications.
- Multi-Brand Support: Operates independently for each brand to ensure stability and isolation.
- Targeted Messaging: Can send messages to specific users across different devices.
- Notification Signaling: Acts as a trigger for other services (like Chorus) to tell the app to refresh its inbox.
How Data Flows (The Journey of a Notification)
When a notification needs to be sent to a user, it follows this general path:
- Trigger: An external service (like the Broadcast Gateway - BCG) decides a message needs to be sent.
- Request: BCG sends a request to OSG saying: "Send this message to User X."
- Lookup: OSG checks its database to see if User X is currently online and which device (connection) they are using.
- Delivery: If the user is online, OSG pushes the message instantly through the open WebSocket connection to the user's browser or app.
- Confirmation: When the user's device receives the message, it sends an "Acknowledgement" back through OSG to BCG, confirming the message was delivered.
Visual Data Flow
How We Track Users (Data Tables)
To make this work, OSG keeps track of who is connected and what they are interested in using a high-speed database (DynamoDB).
Messaging Subscriptions Table
This is like a "Preference List." It maps users to their connections and the specific types of messages they want to receive.
- What it stores: The User's Account ID, the Connection ID, and the Topic (e.g., relevantMessaging or notification).
- Purpose: When we want to send a message, this table tells us: "User 123 is connected via Connection ABC and is interested in Topic X."
Summary
| Feature | Business Value |
|---|---|
| Low Latency | Users see updates (like safety messages or offers) instantly without refreshing the page. |
| Efficient Scaling | Uses a "serverless" architecture (AWS Lambda), meaning it automatically scales up during huge events (like the Grand National or World Cup) and scales down when quiet. |
| Reliability | Includes a confirmation loop (Acknowledgements) so we know exactly which messages reached the customer. |
