GithubHelp home page GithubHelp logo

uncleios / gotalk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ritwizsinha/gotalk

0.0 0.0 0.0 10.3 MB

A CLI P2P chat application in go which supports 7(configurable) clients at a time

Go 100.00%

gotalk's Introduction

GoTALK

A CLI P2P chat application in go which supports 7(configurable) clients at a time

Design

There are 2 main parts to the application
- Client: The process on which the user can see other active users and send messages to send by prepending the message with the username/. For example
    ```
    username = Ritwiz
    Message = Ritwiz/Hello How are you ?
    ```
    The client first asks the user the name they want to be referenced as in the chat
    After entering the name the client gets the list of active clients, establishes a TCP listener server off the main thread, and asks the user whether he/she wants to 
    send a message or exit the application. 
    If the user wants to send a message they are given a list of active users on the server  and the user can select any of them and message them
    The message appears on the same terminal the user is working on

- Server: Keeps a list of all the active clients
    The server has a list of 7 ports numbers (This can be manually increased). The server supports stateless connections. Once a client connects to the
    server it can execute 3 operations according to the ARG protocol [A custom naive protocol over TCP named just for the sake of it  : ) ]
    - A: Add the user to the list of active clients 
    The client sends a string preceded by character A and followed by the name of the client. For example if the name of the client is "RAM"
    then the client will send "ARAM" to the server. The server intercepts the message and adds the user to the active users list and assigns a free port to the user
    - R: Remove the user from the active list of users (when the user exits)
    The user will send the name of the client appended with the "R" to indicate the user wants to leave the chat. The port number is freed and is added to the free port list
    - G: Get the list of all connected clients and their port numbers

Installation

  1. Install go
  2. Go the project directory and for compiling the server
cd server
go build server.go
  1. For compiling the client
cd client
go build client.go

Running

If you don't want to compile or install go the executable files are also attached with project for both the client and the server. The server can be started using

./server

For starting an instance of the client

./client

Multiple clients maybe started depending on the number of ports configured in the server

gotalk's People

Contributors

ritwizsinha 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.