๐ ๏ธ Learning WebSocket by Doing: How I Built Real-Time Appointment Notifications


๐งฉ The Problem
Recently while working on a project, I had to implement a feature:
When a customer books an appointment, the manager must get notified in real-time.
After thinking through it, two options came to mind:
A refresh button to fetch new data
Use WebSockets for real-time updates
Guess which one I chose?
๐ Why WebSocket?
Simply put, WebSocket upgrades the HTTP connection to create a persistent connection between client and server. This means:
Server can push data to clients
All connected users receive updates instantly
Perfect for real-time use cases like:
Chat apps
Notifications
Live dashboards
๐ง My Learning Process
At first, I thought it would be difficult...
But after watching a few YouTube videos (big thanks to CodeWithHarry and Anuj Bhaiya) and researching on GPT, I understood the basics and got to work.
I created a socket.js
file, handled io.on("connection")
, and emitted an event whenever a new appointment was created.
๐งช Result
The feature was successfully implemented and eventually got merged into the codebase after a few fixes.
It was a huge confidence boost, and a reminder that:
The best way to learn is often by building.
๐ What I Used:
React.js (frontend)
Node.js + Express (backend)
socket.io
for WebSocketMongoDB
GitHub for collaboration
๐ฌ Final Thoughts
This wasn't just about WebSocket โ it was about learning in the flow of work.
If you're stuck between theory and real-world coding โ pick the real-world problem.
Subscribe to my newsletter
Read articles from Ishant directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
