Real-Time Dispatching with WebSockets
Backend

Real-Time Dispatching with WebSockets

Kaleb McIntosh
Nov 28, 2025
7 min read

## The Need for Real-Time

In luxury transportation, timing is everything. Clients expect immediate confirmation, and drivers need instant dispatch notifications.

WebSocket Integration

Setting Up Socket.io

const { Server } = require('socket.io');
const io = new Server(server, {
  cors: {
    origin: 'https://your-app.com',
    methods: ['GET', 'POST']
  }
});

Sending Dispatch Notifications

const notifyDriver = async (driver, booking) => {
  io.to(`driver:${driver.id}`).emit('new-booking', {
    pickup: booking.pickup,
    time: booking.time,
    clientName: booking.clientName
  });
};

Real-Time Status Updates

// WebSocket for live tracking
io.on('connection', (socket) => {
  socket.on('driver:location', async (data) => {
    await updateDriverLocation(data);
    io.to(`booking:${data.bookingId}`).emit(
      'location:update', 
      data
    );
  });
});

Results

  • Average notification delivery: < 100ms
  • Real-time bidirectional communication
  • Live tracking for clients
Kaleb McIntosh

Kaleb McIntosh

Full-Stack Software Engineer

Founder, McIntosh Digital Solutions

Kaleb McIntosh | Full-Stack Software Engineer