Skip to content

Snowmass22/chatx

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chatx

https://chatx-zbry.onrender.com/

A scalable, real-time chat application built with Node.js and Socket.IO, featuring SQLite persistence and multi-core clustering support.

Features

  • Real-time Communication: Powered by Socket.IO for low-latency messaging.
  • Scalability: Implements Node.js native clustering with @socket.io/cluster-adapter to utilize available CPU cores.
  • Data Persistence: Messages are stored securely in a local SQLite database (chat.db).
  • Connection Recovery: Built-in support for connection state recovery to handle temporary disconnects without losing messages.

Tech Stack

  • Backend: Node.js, Express
  • WebSockets: Socket.IO
  • Database: SQLite (sqlite3, sqlite)
  • Clustering: @socket.io/cluster-adapter

Installation

  1. Navigate to the project directory.

  2. Install the required dependencies:

    npm install express socket.io sqlite3 sqlite @socket.io/cluster-adapter

    Note: If you are using PowerShell on Windows and encounter errors installing the cluster adapter, wrap the package name in quotes: '@socket.io/cluster-adapter'.

Usage

  1. Start the server:

    node index.js
  2. The application will spawn worker processes based on your available CPU cores.

  3. Open your web browser and navigate to http://localhost:3000.

File Structure

  • index.js: The main server file containing clustering logic, database setup, and socket event handlers.
  • index.html: The client-side HTML file serving the chat interface.
  • chat.db: The SQLite database file (auto-generated upon first run).

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors