How I Built Live Exam Monitoring That Works With Zero Internet (SignalR + ASP.NET Core)
Most schools I work with in Nigeria can't count on the internet during exams. Power flickers, data runs out, the network drops. But they still want computer-based tests, and they want the exam officer to see every studen
Most schools I work with in Nigeria can't count on the internet during exams. Power flickers, data runs out, the network drops. But they still want computer-based tests, and they want the exam officer to see every student live: who has joined, what question they're on, whether they've switched tabs, and whether their laptop is about to die.
So I built Exam Box, an offline computer-based testing (CBT) platform that schools now use for their real exams. This post is about the part I'm proudest of: the live monitor that runs with no internet at all.
The setup: one PC is the server
There's no cloud. The exam officer installs a Windows desktop app (.NET 8 WPF), and that app hosts its own web server inside it:
+----------------------------------+
| Admin PC (WPF app) |
| |
| Admin UI <--> ASP.NET Core |
| (Kestrel :5000) |
| |
| REST API | SignalR | SQLite |
+----------------------------------+
|
school LAN / Wi-Fi
|
+------------+------------+
| | |
[Browser] [Browser] [Browser]
Student 1 Student 2 Student N
The admin clicks Start Server, then Start Session, and gets a session code and a join URL like http://192.168.1.100:5000?code=A1B2C3. Students open that URL in any browser on the same network. Nothing to install on their machines.
Everything (exams, answers, results) lives in a local SQLite database through EF Core.
Real-time with SignalR groups
The live part is a single SignalR hub. The trick that made it clean was groups: each session gets an admin group and a student group, so one exam room never sees another room's traffic.
public class ExamHub : Hub
{
public async Task JoinAdminGroup(string sessionCode) =>
await Groups.AddToGroupAsync(Context.ConnectionId, $"admin_{sessionCode}");
public async Task JoinStudentGroup(string sessionCode) =>
await Groups.AddToGroupAsync(Context.ConnectionId, $"students_{sessionCode}");
// Student did something -> only that session's admins hear about it
public static Task NotifyStudentUpdate(IHubContext<ExamHub> hub, string sessionCode, object payload) =>
hub.Clients.Group($"admin_{sessionCode}").SendAsync("StudentUpdated", payload);
// Admin hits "End All" -> every student in the session auto-submits
public static Task NotifyForceSubmit(IHubContext<ExamHub> hub, string sessionCode) =>
hub.Clients.Group($"students_{sessionCode}").SendAsync("ForceSubmit");
}
Messages flow both ways:
-
Student β admin: answering a question, switching tabs, connection and battery updates. The API saves it, then pushes
StudentUpdatedto the admin group. - Admin β students: exam started, session ended, force submit, or kicking one student back to login.
For that last one, every student also joins a private group just for them. To join it, the browser has to send its exam token, which the server validates first, so a student can't pretend to be someone else:
public async Task<bool> JoinStudentSelf(string token)
{
var id = StudentTokens.Validate(token);
if (id is null) return false; // forged or expired token joins nothing
await Groups.AddToGroupAsync(Context.ConnectionId, SelfGroup(id.Value));
return true;
}
What the exam officer actually sees
The Monitor tab updates live for each student:
- questions answered and current question
- time left
- connection status and battery level
- tab switches and other violations
When the exam ends, results are ready immediately. No collating scripts, no manual marking.
Lessons from running it in real schools
1. Always have a fallback for the realtime channel.
School Wi-Fi is messy, and WebSocket connections drop. On the student side I reconnect automatically and re-join the private group, and if SignalR can't connect at all, a regular heartbeat request keeps the admin's view up to date:
examHub.onreconnected(joinSelf);
examHub.start()
.then(joinSelf)
.catch(() => { /* offline β heartbeat poll is the fallback */ });
2. Save progress on every answer.
Every answer is saved to the server as the student goes. If a laptop dies mid-exam, the student logs back in and continues from the same question, with the same answers and the same timer.
3. Never send the answer to the browser.
Questions and options are shuffled per student (Fisher-Yates). The server tracks the correct answer by value, not by position, and the student's page never receives it.
4. Firewalls will get you.
The most common support issue wasn't code at all: Windows Firewall blocking port 5000. Now that's the first thing in the troubleshooting guide.
Wrapping up
You don't always need the cloud to build something real-time. A desktop app hosting ASP.NET Core and SignalR on the local network turned out to be the right tool for schools that can't count on the internet, and it now runs live exams in real schools.
If you've built something real-time for unreliable networks, I'd love to hear how you handled reconnects. Drop it in the comments.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.