Giter Site home page Giter Site logo

davidado / go-chat-rooms Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 19 KB

A multi-chatroom application implemented in Go that handles websocket connections, message broker transmissions, and client and room management

License: MIT License

Makefile 0.62% Go 82.56% HTML 16.82%

go-chat-rooms's Introduction

Overview

A multi-chatroom application implemented in Go that handles websocket connections and the transmission of messages to different rooms over a swappable message broker.

Features

This chat application is deployable to multiple servers behind a load balancer. Each instance handles websocket connections and manages clients and rooms while broadcasting messages through a message broker like Redis, RabbitMQ, or one of your own implementation.

  • Anonymous users are allowed by default but can be configured in the .env file with ALLOW_ANON="false".
  • Authentication middleware is implemented with JSON web tokens. Set JWT_SECRET in .env before use.
  • This application does not implement a signup or login process but can verify and parse existing JSON web tokens stored in either a cookie (set COOKIE_NAME in .env) or transmitted through the request header in the Authorization field. The only field necessary in the token is username. Refer to pkg/auth/jwt.go for more details.

Prerequisites

  • Go 1.22+ since the project uses its routing features but it should be fairly straightforward to implement your own router if using earlier versions of Go.

  • A running instance of Redis or RabbitMQ. If you do not already have a running instance, you can run docker run -d --name redis -p 6379:6379 redis to run a local Redis instance in Docker.

Installation

  1. Download or clone the project to your workspace: git clone https://github.com/davidado/go-chat-rooms

  2. Edit the Makefile and set the MAIN_PACKAGE_PATH to either ./cmd/redis or ./cmd/rabbitmq (default is ./cmd/redis).

Usage

  1. Execute make run in the root path (same directory as the Makefile).

  2. Go to http://localhost:8080/[room] where [room] can be anything you choose.

  3. Test the room by going to the same URL in another tab or browser and type away.

Contributing

Contributions are welcome.

go-chat-rooms's People

Contributors

davidado avatar

Stargazers

dokjin.yoon 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.