{"id":26820418,"url":"https://github.com/zvdy/go-websocket-chat","last_synced_at":"2025-07-21T10:32:12.271Z","repository":{"id":199930354,"uuid":"704114293","full_name":"zvdy/go-websocket-chat","owner":"zvdy","description":"Chat app built with Go and WebSockets. It allows multiple users to join a chat room and send messages to each other in real time.","archived":false,"fork":false,"pushed_at":"2023-10-15T13:24:59.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-30T06:32:24.788Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","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/zvdy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-10-12T15:05:34.000Z","updated_at":"2024-11-13T10:06:28.000Z","dependencies_parsed_at":"2025-03-30T06:32:10.775Z","dependency_job_id":"28074896-43d8-4c4f-aa95-818428089754","html_url":"https://github.com/zvdy/go-websocket-chat","commit_stats":null,"previous_names":["zvdy/go-websocket-chat"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/zvdy/go-websocket-chat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fgo-websocket-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fgo-websocket-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fgo-websocket-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fgo-websocket-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zvdy","download_url":"https://codeload.github.com/zvdy/go-websocket-chat/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zvdy%2Fgo-websocket-chat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266285391,"owners_count":23905332,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2025-03-30T06:32:03.351Z","updated_at":"2025-07-21T10:32:12.255Z","avatar_url":"https://github.com/zvdy.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📢 Chat App\n\nThis is a simple chat app built with Go and WebSocket. It allows multiple users to join a chat room and send messages to each other in real time.\n\n## ⚙️ Installation\n\nTo install the chat app, you need to have Go installed on your computer. You can download and install Go from the official website: https://golang.org/dl/\n\nOnce you have Go installed, you can download the chat app source code by running the following command in your terminal:\n\n```\ngit clone https://github.com/zvdy/go-websocket-chat.git\n```\n\n\nThis will download the chat app source code to your current directory.\n\n## 🧑‍💻 Usage\n\nTo start the chat app server, navigate to the `go-websocket-chat` directory in your terminal and run the following command:\n\n```\ngo run main.go\n```\n\u003e You can also build the chat app server by using the Dockerfile in the root directory of the project. To do this, run the following command in your terminal: `docker build -t go-websocket-chat .` This will build the chat app server and tag it as `go-websocket-chat`. You can then run the chat app server by running the following command: `docker run -p 8080:8080 go-websocket-chat`. [Here](https://hub.docker.com/r/zvdy/go-websocket-chat/tags) is the latest docker tag.\n\nThis will start the server on port 8080. You can access the chat app by going to `http://localhost:8080/chat` in your web browser.\n\nTo join a chat room, append the `room` query parameter to the URL. For example, to join a chat room with ID `test`, go to `http://localhost:8080/chat?room=test`.\n\n![image](/images/sample.png)\n\nTo send a message to the chat room, type your message in the input field at the bottom of the chat window and press Enter. Your message will be broadcast to all users in the chat room.\n\nYou can also send messages programmatically using the WebSocket API. To do this, you need to open a WebSocket connection to the chat app server and send JSON messages with the following format:\n\n```json\n{\n  \"username\": \"Cristian\",\n  \"text\": \"Hello, world!\"\n}\n```\nReplace Alice with your username and Hello, world! with your message text.\n\nYou can use the following curl command to send a message to the chat room:\n\n```\ncurl -X POST -H \"Content-Type: application/json\" -d '{\"username\":\"your_username\",\"text\":\"your_message\"}' http://localhost:8080/message?room=your_room_id\n```\n\n\n---\n\n\nTo open a WebSocket connection, send an HTTP GET request to the /ws endpoint with the room query parameter. For example, to join a chat room with ID test, run the following command in your terminal:\n\n```\ncurl -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Sec-WebSocket-Version: 13\" -H \"Sec-WebSocket-Key: SGVsbG8sIHdvcmxkIQ==\" http://localhost:8080/ws?room=test\n```\n\nReplace the test with the ID of the chat room you want to join.\n\nThe output should look like this:\n\n```\nHTTP/1.1 101 Switching Protocols\nUpgrade: websocket\nConnection: Upgrade\nSec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=\n```\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzvdy%2Fgo-websocket-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzvdy%2Fgo-websocket-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzvdy%2Fgo-websocket-chat/lists"}