Giter VIP home page Giter VIP logo

chatmessagebroker's Introduction

Chat Message Broker

Golang Message Broker of Chat application, part of distributed system

Project includes both server (broker) and client apps.

Install

Clone repo in to your machine and run go mod download

Broker

Change directory to broker folder which is the main directory for broker app.

Check config yaml file for adopting all available broker configuration.

Build

You should have working setup of GO environment.

Run make in the project root. Start broker_app and client_app.

Run

Broker

Broker app accepts:

  • --config flag which represents the path to config file.
    Default value for --config flag is ./broker/config.yaml. Modify path to config file only in case you use or change config path location.
  • --connection flag which represents socket connection type.
    Broker supports tcp-socket and websocket connections. Default flag value is all which enables all connection types.

Client

Client app accepts:

  • --host flag which represents Broker host address. Default value is 0.0.0.0
  • --port flag which represents Broker host address port number. Default value is 8888
  • --connection-type flag which represents Broker connection. Default value is tcp

Pass new values only in case you want to modify default flag values.

How to use

Broker accepts 3 types of messages

  • Direct message
  • Channel message
  • Command message

Client app defines for each type of message special symbol

  • Direct message -> @. Message example: @{$USER_NAME} {$MESSAGE_TEXT}
  • Channel message -> #. Message example: #{$CHANNEL_NAME} {$MESSAGE_TEXT}
  • Command message -> /. Message example: /{$SUPPORTED_COMMAND}

At broker app start is created one default channel random.

At client connection, broker app registers new user. All users are by default subscribed to random channel.

Broker supports various commands which allow users to interact with broker workspace.

Broker supported commands:

  • create- creates a new channel. User who created channel is subscribed to it by default. Command example: /create {$CHANNEL_NAME}
  • join - joins a specific channel. Command example: /join {$CHANNEL_NAME}
  • leave - joins a specific channel. Command example: /leave {$CHANNEL_NAME}
  • show - displays specific info about workspace or channel. Command example: /show {$OPTION} Show command supports 4 options:
    • users - displays list of all workspace users.
    • channels - display list of all workspace channels
    • all - display list of all workspace users and channels
    • $CHANNEL_NAME - display list of all users subscribed to a specific channel. Ex. /show random

chatmessagebroker's People

Contributors

asv44 avatar

Stargazers

Dipayan Paul avatar  avatar KoHny avatar

Watchers

James Cloos avatar

chatmessagebroker's Issues

Add message persisting

Background

Currently messages and all communication between clients is not persisted anywhere. Communication data is living only in memory. After disconnecting from broker, client lost totally all previous messages and communication data.

Requirements

  1. Add persisting of users and user related data
  2. Add message persisting into database
  3. Provide previous messages persisted at previous connection sessions

Add user authentication and request authorization

Background

Now all communication is totally open. There is nothing regarding user authorization and request authentication. In order to ensure secure communication and user verification it will be good to have user verification and request validation

Requirements

  1. Add user authentication
  2. Add request authorization

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.