Developer Guide

Real-Time Match Updates in ASP.NET Forums: WebSocket vs. Polling

 ·  by ASP Playground Dev Team  ·  10 min read

📄 Download this guide as PDF Offline reference — Real-Time Match Updates in ASP.NET Forums: WebSocket vs. Polling
View PDF

The Core Problem: Stale Scores

When a goal is scored during a World Cup match, fans on your ASP.NET forum should see it within seconds — not after their next page refresh. This guide compares two approaches: HTTP polling and WebSocket/SignalR, so you can choose the right tool for your traffic level and hosting plan.

Option A — HTTP Polling (Simple, Works Everywhere)

The simplest approach: a JavaScript setInterval calls a lightweight /api/match-update?id=123 endpoint every 15–30 seconds. The endpoint reads from a server-side cache (populated by your background score fetcher) and returns a small JSON diff.

setInterval(async () => {
  const res = await fetch('/api/match-update?id=' + matchId);
  const data = await res.json();
  updateScoreboard(data);
}, 20000);

Pros: works on all hosting plans, no special IIS configuration, compatible with APG vNext's standard page structure.
Cons: generates N requests/minute per active user; high traffic = high server load.

Option B — SignalR (Real-Time Push)

SignalR is a Microsoft library that abstracts WebSockets (falling back to Server-Sent Events or long polling) for ASP.NET. A hub pushes score updates to all connected clients the moment your background job receives new data from the API.

public class ScoreHub : Hub {
    public static async Task BroadcastScore(MatchScore score) {
        await GlobalHost.ConnectionManager
            .GetHubContext<ScoreHub>()
            .Clients.All.updateScore(score);
    }
}

Pros: instant updates, efficient at scale (one server push vs. thousands of poll requests).
Cons: requires WebSocket support in IIS (enabled in IIS 8+), slightly more complex setup.

Which Should You Use?

FactorPollingSignalR
Server load at 1,000 users~50 req/s~1 push/score event
Update latency0–30 seconds<1 second
Setup complexityLowMedium
IIS requirementAny versionIIS 8+

For most sports communities under 500 concurrent users, polling every 20 seconds is perfectly adequate and requires zero infrastructure changes. Scale to SignalR when you hit capacity.

Integrating with APG vNext

APG vNext threads become live match commentary feeds when you inject a score banner at the top of each thread page. Use a custom Master Page or HTTP Module to inject the polling script on any thread tagged with a match ID. Forum posts appear in real time below the scoreboard, creating a combined live-score + live-commentary experience without building a custom application.

Further Reading

See it in practice

We applied these techniques to build the Yalla Shoot streaming app guide — a real-world ASP.NET web application serving live sports content.

View Yalla Shoot Technical Guide →