Simple TCP-based chat server

hub-server

Simple TCP-based chat server. Client can be found: https://github.com/alankritjoshi/hub-client

Setup

  1. go run server.go 1234

How it works

  1. Use SyncMap for maintaining concurrent access to different clients
  2. Use Go Routines for handling connection
  3. Use handlers for input:
    1. "whoami" -> returns clientID of the requesting client
    2. "whoelse" -> returns space-separated clientIDs connected to server apart from requesting client
    3. "send [message] [clientID 1] [clientID 2] ... [clientID 3]" -> sends [message] to specified space-separated clientIDs

Checks in place

  1. Hard limit of 255 simultaneous connections
  2. Rejection of commands other than described above

Testing

Manual Testing

  1. Tested basic functionality
  2. Spun up 100 chat connections using a script and applied a sequence of 1. whoelse and 2. send [random_word] [list of clientIDs from 1.]

Unit Testing

  1. Unable to make connection mocking work in interest of time so added a unit test outline once connection mocking is available

To Improve

  1. Use structs to simplify data sharing for handlers
  2. Use better error handling structs/package for consistent error to the client
  3. Figure out how to mock connections for unit tests
  4. Find an optimal way of making the "whoelse" handler work. I forgot that there's no concept of sets in GoLang but the Map can be utilized better instead of printing each clientID on the fly
Similar Resources

go-chat is a gRPC based chat CLI written in golang for command line lovers

go-chat is a gRPC based chat CLI written in golang for command line lovers

go-chat go-chat is a gRPC based chat CLI written in golang for command line lovers. This CLI allows you to chat with your friends without leaving the

Oct 14, 2022

Client - Server TCP Chat For String Messages And Random Files

GoChat Client - Server TCP Chat For String Messages And Random Files GoChat is a chat for string messages and random files using Golorem by Derek A. R

Sep 29, 2021

Multiplexer over TCP. Useful if target server only allows you to create limited tcp connections concurrently.

tcp-multiplexer Use it in front of target server and let your client programs connect it, if target server only allows you to create limited tcp conne

May 27, 2021

Websocket-chat - A simple websocket chat application

Websocket-chat - A simple websocket chat application

WebSocket Chat App This is a simple chat app based on websockets. It allows user

Jan 25, 2022

a distributed chat system which can be used as chat rooms or state synchronization

a distributed chat system which can be used as chat rooms or state synchronization

unitalk is a distributed chat system which can be used as chat rooms or state synchronization. unitalk registers itself on zookeeper when it start up, use redis cluster to broadcast messages or state, and permanent messages or state to kafka and then save to db.

Aug 5, 2021

Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Placeholder for the future project (lets-go-chat)Placeholder for the future project (lets-go-chat)

Jan 10, 2022

Encrypted-websocket-chat - Encrypted websocket chat using golang

Encrypted websocket chat First version written in python This version should be

Sep 15, 2022

Go-random-chat - Fast and scalable real-time random chat written in go

Go-random-chat - Fast and scalable real-time random chat written in go

Go Random Chat Fast and scalable real-time random chat written in go. Features:

Dec 21, 2022

Chat - Console mode chat done in Go, PHP and MySQL

Chat modo consola hecho en GO y PHP(https://github.com/RicardoValladares/AJAX) G

Nov 10, 2022

Command-Line chat app in Go-Lang over TCP

gochat Simple chat communication app over TCP, wrriten in Golang. How does it work? Each client starts a TCP server, in a port that is defined by the

Jan 9, 2022

TcpRoute , TCP 层的路由器。对于 TCP 连接自动从多个线路(电信、联通、移动)、多个域名解析结果中选择最优线路。

TcpRoute2 TcpRoute , TCP 层的路由器。对于 TCP 连接自动从多个线路(允许任意嵌套)、多个域名解析结果中选择最优线路。 TcpRoute 使用激进的选路策略,对 DNS 解析获得的多个IP同时尝试连接,同时使用多个线路进行连接,最终使用最快建立的连接。支持 TcpRoute

Dec 27, 2022

TCP output for beats to send events over TCP socket.

beats-tcp-output How To Use Clone this project to elastic/beats/libbeat/output/ Modify elastic/beats/libbeat/publisher/includes/includes.go : // add i

Aug 25, 2022

Instant, disposable, single-binary web based live chat server. Go + VueJS.

Instant, disposable, single-binary web based live chat server. Go + VueJS.

Niltalk Niltalk is a web based disposable chat server. It allows users to create password protected disposable, ephemeral chatrooms and invite peers t

Jan 4, 2023

“Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server!

Dear Port80 About The Project: “Dear Port80” is a zero-config TCP proxy server that hides SSH connection behind a HTTP server! +---------------------

Jun 29, 2022

EasyTCP is a light-weight and less painful TCP server framework written in Go (Golang) based on the standard net package.

EasyTCP is a light-weight TCP framework written in Go (Golang), built with message router. EasyTCP helps you build a TCP server easily fast and less painful.

Jan 7, 2023

Client-Server tcp-based file transfer application in GoLang

Клиент-серверный файловый сервис на базе протокола TCP Клиент client.go шифрует свои файлы алгоритмом AES с режимом CBC и помещает их на сервер server

Apr 1, 2022

Simple chat client that uses github.com/tydar/stomper as a backing server.

STOMP Chat Chat client to operate through a STOMP pub/sub server. Designed to demonstrate my project stomper. Todo to finish: Allow runtime configurat

Dec 23, 2021

Tcp-proxy - A dead simple reverse proxy server.

tcp-proxy A proxy that forwords from a host to another. Building go build -ldflags="-X 'main.Version=$(git describe --tags $(git rev-list --tags --max

Jan 2, 2022

Simple TCP proxy to visualise NATS client/server traffic

Simple TCP proxy to visualise NATS client/server traffic

NATS uses a simple publish/subscribe style plain-text protocol to communicate between a NATS Server and its clients. Whilst this connection should remain opaque to the user, it can be quite handy to see the data being passed from time to time - this tool does just that (it also saves me loading Wireshark and filtering the NATS traffic).

Jan 15, 2022
Self hosted live chat server written in Go

goch is a self-hosted live-chat server written in Go. It allows you to run a live-chat software on your own infrastructure. You can create multip

Dec 11, 2022
Open-IM-Server is open source instant messaging Server.Backend in Go.
Open-IM-Server is open source instant messaging Server.Backend in Go.

Open-IM-Server is open source instant messaging Server.Backend in Go.

Dec 31, 2022
A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)
A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)

A simple server for sending and receiving messages in real-time per WebSocket. (Includes a sleek web-ui)

Jan 9, 2023
Scalable real-time messaging server in language-agnostic way
Scalable real-time messaging server in language-agnostic way

Centrifugo is a scalable real-time messaging server in language-agnostic way. Centrifugo works in conjunction with application backend written in any

Jan 1, 2023
Instant messaging server for the Extensible Messaging and Presence Protocol (XMPP).
Instant messaging server for the Extensible Messaging and Presence Protocol (XMPP).

Instant messaging server for the Extensible Messaging and Presence Protocol (XMPP).

Dec 31, 2022
Event-based stateful IRC client framework for Go.

GoIRC Client Framework Acquiring and Building Pretty simple, really: go get github.com/fluffle/goirc/client There is some example code that demonstra

Nov 9, 2022
Simple TCP-based chat server

hub-server Simple TCP-based chat server. Client can be found: https://github.com/alankritjoshi/hub-client Setup go run server.go 1234 How it works Use

Oct 25, 2021
A TCP socket based chat server implemented using Go

Go Chat Server A better TCP socket chat server implemented using Go Connecting nc localhost 5000 Docker Build the container image docker build -t grub

Oct 16, 2021
TCP based Client/Server chat CLI in Go
 TCP based Client/Server chat CLI in Go

TCP based Client/Server chat CLI in Go Written in Go, this is a simple implementation of a TCP server that can detect new clients connecting and disco

Jul 27, 2022