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

IshantIshant
2 min read

๐Ÿงฉ 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:

  1. A refresh button to fetch new data

  2. 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 WebSocket

  • MongoDB

  • 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.

0
Subscribe to my newsletter

Read articles from Ishant directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Ishant
Ishant