Giter VIP home page Giter VIP logo

chat-app-using-websockets's Introduction

Chat App Using WebSockets

This chat application allows users to communicate in real-time. It supports broadcasting messages to all users, private messaging, user nicknames, and live status updates for users joining or leaving the chat. The application is built using Node.js, Express.js for the server, and Socket.io for WebSockets communication.

Screenshots

Output Screenshot

Output Screenshot

Users can chat in real-time

Chatting Screenshot

User can exit the room/chat

Disconnect Screenshot

Features

  • Real-time messaging
  • Private messaging
  • Nicknames support
  • "User is typing" notification
  • Live user status updates
  • Stunning UI

How to Run the Project

  1. Clone the repository:

    git clone https://github.com/vasanthsai14/Chat-App-Using-WebSockets.git
  2. Navigate to the project directory:

    cd Chat-App-Using-WebSockets
  3. Install the dependencies:

    npm install
  4. Run the server:

    npm start
  5. Open your browser and go to:

    http://localhost:9000
    

Socket.io Explanation

Socket.io is a JavaScript library for real-time web applications. It enables real-time, bidirectional, and event-based communication between web clients and servers. Socket.io consists of two parts:

  • A server-side library for Node.js
  • A client-side library that runs in the browser

Key Concepts:

  • Connection: Establishes a connection between the client and server.
  • Events: Named messages sent between the client and server.
  • Broadcasting: Sending a message to multiple clients.

Example Usage:

In the server code:

io.on("connection", (socket) => {
    socket.on("user-message", (data) => {
        socket.broadcast.emit("message", data);
    });
});

chat-app-using-websockets's People

Contributors

vasanthsai14 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.