Developing a Mobile App for Sports Betting
A sportsbook app—real-time system with thousands of simultaneously updating odds, strict geolocation control requirements, complex payment infrastructure. 3–5 second delay in coefficient updates—users bet on stale data, operator loses money. Central technical task: data freshness.
Real-Time Odds: Not Polling, Push
WebSocket—only sensible approach for live odds. REST polling every 3 seconds for 500 open matches creates unacceptable load and still isn't real-time. Scheme: single WebSocket connection, subscribe to events (SUBSCRIBE {market_ids: [...]}), server sends diff ({market_id: 123, outcomes: [{id: 1, odds: 2.45}]}), client applies diff to local state.
On iOS: URLSessionWebSocketTask + Combine publisher for distributing updates across ViewModels. On Android: OkHttp WebSocket + StateFlow / SharedFlow via BettingRepository. On connection loss—reconnect with exponential backoff and resubscribe same markets. Visually—micro-animation for coefficient change (green/red flash on rise/fall via animate() in Compose or UIView.animate in UIKit).
Suspended markets. Before major event or technical issues, match goes suspend—bets blocked. App receives {market_id: 123, status: "suspended"} and immediately disables "Place bet" button without screen transition. If user already filling slip—show inline warning.
Betting Slip and Betslip
Betslip—technically most complex UI component in betting app. User adds selections—app calculates accumulator odds in real-time: total_odds = outcome_1_odds × outcome_2_odds × ... × outcome_n_odds. When any coefficient changes while betslip open—update with animation and offer Accept Changes.
Bet placement flow:
- User taps "Place bet" → local validation (balance, min/max stake).
- POST
/betswith{selections, stake, idempotency_key}→ server reserves amount. - Server returns
{bet_id, status: "accepted"/"pending"/"rejected", actual_odds}. - If
actual_oddschanged—show dialog "Coefficient changed from 2.50 to 2.45. Accept?"
idempotency_key (UUID, generated client-side) is mandatory. Duplicate POST on network issues shouldn't create two bets.
Geolocation Control
License requirements in most jurisdictions—bets only from permitted territory. On mobile: request CLLocationManager (requestWhenInUseAuthorization) or LocationManager (Android FusedLocationProviderClient) on app open. Send coordinates to server, server decides via GeoIP + device location.
VPN detection: compare IP geolocation with device GPS. Significant discrepancy (IP different country)—flag for extra verification, not immediate ban.
Payments and Withdrawal
Betting apps process payments via Payment Service Providers specializing in gambling: Payvision, Skrill, Neteller, PaySafe. Standard card flow: Apple Pay / Google Pay for fast deposit (PKPaymentRequest / Google Pay API), credit card via PCI-DSS compliant hosted fields PSP. Card data never pass our server, only token.
3DS2—mandatory for European cards. Most PSPs provide SDK with embedded 3DS challenge screen—no need to implement, but must handle callback post-challenge (success/failure).
Deposit limits, responsible gambling tools (self-exclusion, deposit limits)—regulatory requirement in licensed jurisdictions. Limit management UI—mandatory settings screen.
Stack and Architecture
Native iOS + Android preferable for performance-critical live odds. Flutter—acceptable with unified flutter team. React Native—only with JSI for WebSocket without JS thread bottleneck.
Clean Architecture: BettingRepository (WebSocket + REST), BetSlipViewModel (accumulator calculation, validation), PaymentRepository (PSP integration), GeoLocationService. Local database: open bets, history—Room/Core Data with migrations.
Process
License audit and jurisdiction selection → API + WebSocket contract design → real-time odds and betslip → payment integration → KYC → geolocation control → QA (load test WebSocket at 1000+ simultaneous updates) → publication.
App Store: gambling category requires special entitlement and license proof. Google Play: Gambling policy with regional restrictions.
Timeline Estimates
MVP (live and prematch odds, singles and parlay bets, basic payments): 8–12 weeks. Full platform with live streaming, cash out, multi-currency, iOS + Android: 3–5 months.







