Skip to content

samuelgamito/go-live-chat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

example workflow Issues License LinkedIn


Real-time Chat Application

A robust real-time chat application with features for managing chat rooms and private conversations using WebSocket technology.
Explore API specs »

Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

This is a real-time chat application backend that enables users to create chat rooms, manage friendships, and engage in real-time conversations. The project utilizes WebSocket technology for real-time communication, MongoDB for persistent data storage, and Redis for managing real-time message delivery.

Key Features

  • Chat Room Management

    • Create new chat rooms
    • Join existing chat rooms
    • Leave chat rooms
    • Real-time updates on room activities
  • Friend System

    • Add new friends
    • Manage friend list
    • Real-time friend status updates
  • Real-time Messaging

    • Send and receive messages instantly
    • Private messaging between friends
    • Message history persistence
    • Real-time delivery status

Built With

  • Go
  • MongoDB
  • Redis
  • WebSocket

Getting Started

Prerequisites

Before running this project, make sure you have the following installed:

  • Go 1.21 or higher
  • MongoDB 6.0 or higher
  • Redis 7.0 or higher

Installation

  1. Clone the repository

    git clone https://github.com/YourUsername/chat-app.git
  2. Install Go dependencies

    go mod download
  3. Set up environment variables

    cp .env.example .env
  4. Configure your MongoDB connection

    # In your .env file
    MONGODB_URI=mongodb://localhost:27017/chatapp
  5. Configure Redis connection

    # In your .env file
    REDIS_URL=redis://localhost:6379
  6. Run the application

    go run main.go

Usage

The application exposes both REST API endpoints and WebSocket connections for different functionalities:

REST API Endpoints

POST /api/v1/rooms           # Create a new chat room
GET /api/v1/rooms           # List all available rooms
POST /api/v1/friends/add    # Add a new friend
GET /api/v1/friends         # Get friend list

WebSocket Endpoints

ws://localhost:8080/ws/chat      # Main WebSocket endpoint for chat

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Samuel Gamito
github.com/samuelgamito

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published