{"id":36438717,"url":"https://github.com/spring1843/chat-server","last_synced_at":"2026-01-11T20:52:53.198Z","repository":{"id":57576454,"uuid":"78471869","full_name":"spring1843/chat-server","owner":"spring1843","description":null,"archived":false,"fork":false,"pushed_at":"2017-03-13T01:48:08.000Z","size":21826,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T03:37:54.733Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spring1843.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-09T21:44:38.000Z","updated_at":"2024-06-20T03:37:54.734Z","dependencies_parsed_at":"2022-08-28T18:01:18.696Z","dependency_job_id":null,"html_url":"https://github.com/spring1843/chat-server","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/spring1843/chat-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring1843%2Fchat-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring1843%2Fchat-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring1843%2Fchat-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring1843%2Fchat-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spring1843","download_url":"https://codeload.github.com/spring1843/chat-server/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spring1843%2Fchat-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28323591,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-11T18:42:50.174Z","status":"ssl_error","status_checked_at":"2026-01-11T18:39:13.842Z","response_time":60,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-11T20:52:51.718Z","updated_at":"2026-01-11T20:52:53.189Z","avatar_url":"https://github.com/spring1843.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Travis-CI](https://travis-ci.org/spring1843/chat-server.svg?branch=master)](https://travis-ci.org/spring1843/chat-server/) [![Report card](https://goreportcard.com/badge/github.com/spring1843/chat-server)](https://goreportcard.com/report/github.com/spring1843/chat-server)\n\n\nChat Server is basic IRC like server written in Go with drivers for Telnet, WebSocket, and HTTP REST.\n\n--\n## Telnet and WebSocket Servers\nUsers can connect to chat server with a simple TCP client like telnet or WebSockets. After connecting to the server users can join or create channels and publicly chat with everyone in the channel. Users can use the /msg command to send private messages to each other. Chat Commands are supported for both Telnet and WebSocket clients.\n\n## Supported Chat Commands\n    /help                       Shows the list of all available commands.\n    /list                       Lists user nicknames in the current channel.\n    /ignore @nickname\t        Ignore a user so that he or she can't send you private messages.\n    /join #channel              Join a channel.\n    /msg @nickname message\t    Send a private message to a user.\n    /quit\t                    Quit chat server.\n\n## HTTP Rest Server\nAdministrators can use the HTTP RESTful endpoints to broadcast a public announcement to everyone connected to the server. There's also an end point to query the messages stored in log files. To see the swagger documentation for RESTful API's please browse ```/docs``` on the HTTP port (4001 by default).  \n\n## How to Run Locally\n- Download and install dependencies by running ```go get github.com/emicklei/go-restful``` and ```go get github.com/gorilla/websocket```\n- Download and install by running  ```go get github.com/spring1843/chat-server/src/``` and then CD into the directory\n- Run all tests ```make test```\n- Modify or review default settings by editing ```config.json```\n- To start serving run ```make serve``` or ```go run main.go -c config.json``` or ```chat-server -c config.json```\n- To check-in new code run ```make checkin``` to automatically format, lint, vet, race check, run all tests and review each change\n\n## How to Connect\nTo connect with telnet when the server is running locally try ```telnet localhost 4000```\nTo connect with a WebSocket open a browser with WebSocket support (such as Google Chrome) and browse to ```http://localhost:4004/client```\nThese ports are defined in config.json\n\n## Logs\nBesides start up messages, everything else is logged in a log file. Almost all interactions including the followings are added to the log file specified at run time along with a timestamp:\n- Public Messages\n- Private Messages\n- Chat commands executed\n- New and closing connections\n- Errors\n\n## Docker\nTo build\n```\ndocker build -t chatserver .\n```\n\nTo run\n```\ndocker run -d -p 4000:4000 -p 4001:4001 -p 4004:4004 -t chatserver\n```\n\nNote that if you are running docker in a VM or boot2docker, the host needs to forward these ports. \n\n## Design\n\nA config structure is initially parsed from the ```.json``` file specified by the ```-c``` flag and passed around to every package.  \n\nThe ```chat``` package is in charge of creating the chat experience. Important entities in this package are Server, User, Channel, ChatConnection, and ChatCommand.\n\nChat server can serve anything that implements the ChatConnection interface providing basic ```io.Writer``` and ```io.Reader``` methods and a few network specific concepts like ```RemoteAddr``` and ```Close```. Examples of such drivers in use are Telnet and WebSockets. \n\nThe Server also exposes certain internal entities and functionality to be used by external entities that do not necessarily have a persistent connection for example the main file is able to attach a logger to the server, and the REST driver can query the server.\n \nOne instance of Chat server is created at the beginning of execution and passed around to different drivers when they are started. When a new connection is made the Server welcomes the new user and tries to identify the user. Upon successful identification the user and the open connection associated with him are attached to the Server until the connection is closed. \n\nAfter identification users can use ```ChatCommand```s are commands that a user can execute on the server. Each command has a syntax and certain parameters. The ```chat``` package is able to identify, parse their parameters from the input and execute them. \n\nUsers can ```/join``` a channel. Users can join only one Channel at any given time and participate in the conversations. They can also send private messages to each other with ```/msg``` command.\n\nChannels, Users and ChatCommands are represented with ```#,@,/``` prefixes respectively.\n\n## Credits\n* [go-restful](https://github.com/emicklei/go-restful) for configuring, standardizing, documenting and running HTTP REST Endpoints\n* [Swagger](http://swagger.io/) for auto generating HTTP REST API's and providng an easy to use front end client ```http://localhost:4001/docs```\n* [Gorilla WebSocket](https://github.com/gorilla/websocket) for handling WebSocket connections and example client ```http://localhost:4004/client```\n\n### Further Improvements\n- Strive for 100% test coverage\n- Deploy to Heroku\n- Handle client tcp disconnect may be ping and pong?\n- Use flags package for parsing command line options\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring1843%2Fchat-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspring1843%2Fchat-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspring1843%2Fchat-server/lists"}