A simple chat server where clients(or rather engineers!) can easily chat through terminal.
Clone the repository in the
$ go get github.com/papriwalprateek/engineer-chat
Start the server
$ go run server.go
The server starts running at
Note: If you have docker installed on your machine, you can build the image and run the server inside the container.
$ docker build -t engineer-chat . $ docker run --publish 6060:5555 --name test --rm engineer-chat
This will start the server at
Alternatively, you can pull the latest image from docker hub and run it directly.
$ docker run -d papriwalprateek/engineer-chat
$ telnet 127.0.0.1 5555
You can send commands or messages on this tcp stream. Commands begin with
/ and messages are anything else.
List of Available Commands
||registers the user with the given username.|
||logout from the chat server.|
||Broadcast the message in the room. Also without
||messages privately to the given user.|
||Joins the given room. If room is not there, it creates the room and then joins it.|
||Leaves the current room and comes back into the lobby.|
||Lists the available rooms.|
||Lists the users in the given room. A simple
||Lists the available commands.|
Sample Chat Session
A sample chat session with 3 clients -
Trying ::1... Connected to localhost. Escape character is '^]'. Welcome to the Engineer Chat Server! Type /help to list the commands Login Name? prateek **username already taken** Login name? prateekp **connect** [prateekp] /users **users in lobby** prateek parijat prateekp /pm parijat lets get into college room **pm** [parijat] ok **enter** [parijat] iit-delhi /users iit-delhi **users in [iit-delhi] room** parijat /enter iit-delhi **enter** [prateekp] iit-delhi prateek cant here us because we are in iit-delhi room and he is in lobby. lol! [prateekp] prateek cant here us because we are in iit-delhi room and he is in lobby. lol! [parijat] yeah lol! /leave **leave** [prateekp] iit-delhi /users iit-delhi **users in [iit-delhi] room** parijat /users **users in lobby** prateek prateekp **disconnect** [prateek] /users **users in lobby** prateekp /quit Connection closed by foreign host.