{"id":19483890,"url":"https://github.com/romulodm/go-chess","last_synced_at":"2026-02-28T07:06:17.055Z","repository":{"id":212571070,"uuid":"728445870","full_name":"romulodm/go-chess","owner":"romulodm","description":"A multiplayer chess game made with React and Gorilla WebSocket.","archived":false,"fork":false,"pushed_at":"2025-02-07T03:43:04.000Z","size":402,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-28T19:38:55.274Z","etag":null,"topics":["chess","chess-game","go","gorilla-websocket","react","websocket"],"latest_commit_sha":null,"homepage":"https://go-chess-ws.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/romulodm.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-12-07T00:42:16.000Z","updated_at":"2025-02-07T03:43:08.000Z","dependencies_parsed_at":"2023-12-26T17:41:43.106Z","dependency_job_id":"4e1b5376-53d3-4806-8baa-0807968dcc67","html_url":"https://github.com/romulodm/go-chess","commit_stats":null,"previous_names":["romulodm/go-chess-ws","romulodm/go-chess"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romulodm%2Fgo-chess","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romulodm%2Fgo-chess/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romulodm%2Fgo-chess/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/romulodm%2Fgo-chess/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/romulodm","download_url":"https://codeload.github.com/romulodm/go-chess/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249064392,"owners_count":21207080,"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":["chess","chess-game","go","gorilla-websocket","react","websocket"],"created_at":"2024-11-10T20:18:30.027Z","updated_at":"2026-02-28T07:06:12.033Z","avatar_url":"https://github.com/romulodm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# :mag_right: Overview\n\u003cp align=\"justify\"\u003e\nThis project was created for a university subject called \"Programming Languages\", with the objective of creating an application in a programming language that we are not very used to using, the language chosen was Go and the idea was to use WebSockets to perform real-time communication between two users in a chess match.\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n\u003cimg src =\"https://i.imgur.com/mR0sxuA.png\"\u003e\n\u003cp align=\"center\"\u003eFigure 1: Home page\u003c/p\u003e\n\u003cbr\u003e\n\n # \t:seedling: Technologies\n **Front-end:**\n\n - `React`\n - `Chess.js`\n - `Chessboardjsx`\n - `Material UI`\n - `Tailwind CSS`\n\n**Back-end:**\n - `Go`\n - `net/http`\n - `Gorilla WebSocket`\n\n\u003cbr\u003e\n\n# :newspaper: Description\n\u003cdiv align=\"justify \"\u003e\nWe have implemented rooms that can have a maximum of two users connected, that is, they are private rooms for a chess game. We use the Gorilla WebSocket framework to create Rooms that have an identification ID, used to enter a room.\n\u003c/div\u003e\n\n \u003cbr\u003e\n\n\u003cdetails open\u003e\n \u003csummary\u003eRoom\u003c/summary\u003e\n \u003cbr\u003e\n  \n ```go\ntype Room struct {\n\tID         string `json:\"id\"`\n\tclients    map[*Client]bool\n\tregister   chan *Client\n\tunregister chan *Client\n\tbroadcast  chan *Message\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n \u003csummary\u003eClient\u003c/summary\u003e\n \u003cbr\u003e\n  \n ```go\ntype Client struct {\n\tName string\n\tconn *websocket.Conn\n\tsend chan []byte\n\troom *Room\n}\n```\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n\u003cdiv align=\"justify \"\u003e\nIn other words, we have two endpoints that upgrade the connection, the first is to create a room and the other is to enter an existing room. In these two endpoints we receive a front-end ID.  \n\u003c/div\u003e\n\u003cbr\u003e\n\n\u003cdetails\u003e\n \u003csummary\u003eServer config\u003c/summary\u003e\n \u003cbr\u003e\n  \n```go\nfunc serverConfig() http.Server {\n\tr := mux.NewRouter()\n\n\tr.HandleFunc(\"/create-room\", func(w http.ResponseWriter, r *http.Request) {\n\t\tserver.CreateRoom(w, r)\n\t})\n\n\tr.HandleFunc(\"/join-room\", func(w http.ResponseWriter, r *http.Request) {\n\t\tserver.JoinRoom(w, r)\n\t})\n\n\treturn http.Server{\n\t\tAddr:              \"127.0.0.1:8000\",\n\t\tHandler:           r,\n\t\tReadTimeout:       15 * time.Second,\n\t\tReadHeaderTimeout: 15 * time.Second,\n\t}\n}\n```\n\u003c/details\u003e\n\n\u003cdetails\u003e\n \u003csummary\u003eComponent that makes the requests\u003c/summary\u003e\n \u003cbr\u003e\n  \n\u003cdiv align=\"center\"\u003e\n  \u003cimg src =\"https://i.imgur.com/Yx3NaXK.png\"\u003e\n\u003c/div\u003e\n\u003cp align=\"center\"\u003eFigure 2: Lobby component\u003c/p\u003e\n\u003c/details\u003e\n\n\u003cimg src =\"https://i.imgur.com/d2Tt2Bz.png\"\u003e\n\u003cp align=\"center\"\u003eFigure 3: Game page\u003c/p\u003e\n\u003cbr\u003e\n\n\n# :electric_plug: WebSocket\n\u003cp align=\"justify\"\u003e\nHTTP is a stateless communication protocol based on request and response transactions. In this model, the client sends a request to the server, which responds with the requested data. Each transaction is independent, and the connection is terminated after each interaction.\n\u003c/p\u003e\n\u003cbr\u003e\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg src =\"https://assets-global.website-files.com/5ff66329429d880392f6cba2/617a90ab08641e631353de50_Websocket%20vs%20HTTP.png\"\u003e\n\u003cp\u003eFigure 4: Differences between HTTP and WebSocket\u003c/p\u003e\n\u003c/div\u003e\n\u003cbr\u003e\n\n\u003cbr\u003e\n\n\u003cp align=\"justify\"\u003e\nIn contrast, WebSocket establishes a persistent connection between the client and server, enabling continuous bidirectional communication. This full-duplex protocol allows both parties to send and receive data simultaneously, facilitating efficient real-time message transmission without the need to initiate new transactions for each interaction, as is the case with HTTP.\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n# :busts_in_silhouette: Contributors\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003cdiv\u003e\n        \u003ca href=\"https://github.com/romulodm\"\u003e\n          \u003cimg src=\"https://avatars.githubusercontent.com/u/106553102?v=4\" width=\"115\"\u003e\n          \u003cbr\u003e\n          \u003cp align=\"center\"\u003eRomulo\u003c/p\u003e\n        \u003c/a\u003e\n      \u003c/div\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cdiv\u003e\n        \u003ca href=\"https://github.com/Samueltdl\"\u003e\n          \u003cimg src=\"https://avatars.githubusercontent.com/u/81890952?v=4\" width=\"115\"\u003e\n          \u003cbr\u003e\n          \u003cp align=\"center\"\u003eSamuel\u003c/p\u003e\n        \u003c/a\u003e\n      \u003c/div\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cdiv\u003e\n        \u003ca href=\"https://github.com/vitorfreitasz\"\u003e\n          \u003cimg src=\"https://avatars.githubusercontent.com/u/108691011?v=4\" width=\"115\"\u003e\n          \u003cbr\u003e\n          \u003cp align=\"center\"\u003eVitor\u003c/p\u003e\n        \u003c/a\u003e\n      \u003c/div\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      \u003cdiv\u003e\n        \u003ca href=\"https://github.com/gabpunk\"\u003e\n          \u003cimg src=\"https://avatars.githubusercontent.com/u/108433377?v=4\" width=\"115\"\u003e\n          \u003cbr\u003e\n          \u003cp align=\"center\"\u003eGabriel\u003c/p\u003e\n        \u003c/a\u003e\n      \u003c/div\u003e\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromulodm%2Fgo-chess","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fromulodm%2Fgo-chess","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fromulodm%2Fgo-chess/lists"}