Skip to content

Real-time multi-client socket programming platform with React frontend, Node.js backend, and live data synchronization

License

Notifications You must be signed in to change notification settings

erfan-nourbakhsh/SocketSync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

SocketSync Logo

SocketSync - Real-Time Multi-Client Socket Programming Platform

React Node.js Socket.IO SQL Server

A comprehensive real-time client-server application for multi-tenant data management and analytics

Features β€’ Architecture β€’ Quick Start β€’ Documentation

πŸ“‹ Project Overview

This project demonstrates advanced socket programming concepts through a real-time multi-tenant management system. Multiple client instances can simultaneously connect to a central server to manage data records, perform statistical operations, and communicate via integrated chat functionality.

🎯 Core Concept

The system implements a scalable multi-client architecture where:

  • Server: Acts as the central data hub and coordination engine
  • Clients: Represent different tenant instances managing their datasets
  • Real-time Communication: Powered by WebSocket connections for instant data synchronization

✨ Features

πŸ–₯️ Server Capabilities

  • Multi-client Socket Management with automatic connection tracking
  • Real-time Database Operations using Microsoft SQL Server
  • Statistical Computing Engine for data performance analytics
  • Live Chat System with message broadcasting
  • CSV Bulk Import support for efficient data entry

πŸ’» Client Features

  • Modern React Interface with Material-UI components
  • Interactive Data Management with form validation
  • Real-time Data Visualization through dynamic tables
  • Statistical Operations Dashboard (Average, Min, Max, Sort)
  • File Upload Integration for CSV data imports
  • Live Chat Integration for client communication

πŸ“Š Statistical Operations

  • Average: Calculate and display performance averages for all records with IDs
  • Sort: Rank records by performance metrics
  • Max: Identify top-performing records in the dataset
  • Min: Find records needing attention or improvement
  • Visit: Quick data inspection with detailed reporting

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    WebSocket/HTTP   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   React Client  β”‚ ◄─────────────────► β”‚   Node.js Server  β”‚ 
β”‚   (Faculty UI)  β”‚                     β”‚  (Express + IO)   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
         β”‚                                        β”‚
         β”‚                                        β”‚
    β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”                              β”Œβ”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”
    β”‚Material β”‚                              β”‚  SQL Serverβ”‚
    β”‚UI + CSS β”‚                              β”‚  Database  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                              β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Communication Flow

  1. Handshake: Client connects to server via Socket.IO
  2. Registration: Faculty details stored in database
  3. Data Exchange: Student records transmitted in real-time
  4. Operations: Statistical queries processed server-side
  5. Results: Computed data returned to requesting client

πŸš€ Quick Start

Prerequisites

  • Node.js 16+ and npm
  • Microsoft SQL Server with Windows Authentication
  • Git for cloning the repository

Installation

  1. Clone the repository

    git clone https://github.com/erfan-nourbakhsh/SocketSync.git
    cd SocketSync
  2. Setup the Server

    cd Server
    npm install
    # Configure database connection in app.js (lines 27-32)
    npm start
  3. Setup the Client

    cd ../Client
    npm install
    npm start
  4. Access the Application

    • Server: http://localhost:8080
    • Client: http://localhost:3000
    • Multiple clients can connect simultaneously

πŸ“– Documentation

Database Schema

The system uses three main tables:

  • faculties: Client connection and faculty information
  • students: Personal details and academic records
  • courses: Subject-wise grades and performance data

Socket Events

Event Direction Description
sendFacultyName Client β†’ Server Register faculty name
sendStudents Client β†’ Server Add individual student
sendStudentsCSV Client β†’ Server Bulk import via CSV
Average Client β†’ Server Request GPA calculations
Sort Client β†’ Server Request ranked student list
Max/Min Client β†’ Server Request performance extremes

CSV Format

first_name,last_name,national_code,id_number,course1,grade1,course2,grade2,course3,grade3,course4,grade4,course5,grade5
John,Doe,1234567890,STU001,Math,85,Physics,92,Chemistry,78,Biology,88,English,90

πŸ› οΈ Technical Stack

Backend

  • Express.js: Web application framework
  • Socket.IO: Real-time bidirectional communication
  • msnodesqlv8: Microsoft SQL Server integration
  • crypto: UUID generation for unique identifiers

Frontend

  • React 18: Modern component-based UI framework
  • Material-UI v5: Professional design system
  • Socket.IO Client: WebSocket client implementation
  • Papa Parse: CSV file processing
  • SweetAlert2: Enhanced user notifications

πŸ”§ Configuration

Server Configuration

Edit Server/app.js to configure your SQL Server connection:

var config = {
  database: "YOUR_DATABASE_NAME",
  server: "YOUR_SERVER_NAME", 
  driver: "msnodesqlv8",
  options: { trustedConnection: true }
};

Client Configuration

The client connects to localhost:8080 by default. Update the socket connection in Client/src/App.js if needed:

const newSocket = io(`http://your-server-url:8080/`);

πŸ“š Advanced Features

Real-time Chat System

  • Faculty members can communicate instantly
  • Message persistence during session
  • User identification with faculty names
  • Broadcast messaging to all connected clients

Performance Analytics

  • GPA Calculations: Automatic average computation
  • Ranking System: Student performance sorting
  • Statistical Insights: Min/max performance identification
  • Data Export: Results formatted for further analysis

File Management

  • CSV Import: Bulk student data upload
  • Form Validation: Comprehensive input checking
  • Error Handling: Graceful failure management
  • Success Notifications: User feedback system

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

🀝 Contributing

Contributions are welcome! Here's how you can help:

  • 🍴 Fork the repository
  • 🌿 Create a feature branch (git checkout -b feature/amazing-feature)
  • πŸ’Ύ Commit your changes (git commit -m 'Add amazing feature')
  • πŸ“€ Push to the branch (git push origin feature/amazing-feature)
  • πŸ”„ Open a Pull Request

πŸ“§ Contact


SocketSync - Built with ❀️ for educational purposes in network programming and real-time applications

About

Real-time multi-client socket programming platform with React frontend, Node.js backend, and live data synchronization

Topics

Resources

License

Stars

Watchers

Forks