{"id":36737003,"url":"https://github.com/code-game-project/go-client","last_synced_at":"2026-01-12T12:24:07.703Z","repository":{"id":50410917,"uuid":"471537778","full_name":"code-game-project/go-client","owner":"code-game-project","description":"The Go client library for CodeGame.","archived":false,"fork":false,"pushed_at":"2023-04-19T14:17:24.000Z","size":165,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-03-14T23:51:37.220Z","etag":null,"topics":["client","go"],"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/code-game-project.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}},"created_at":"2022-03-18T22:51:03.000Z","updated_at":"2024-03-14T23:51:37.221Z","dependencies_parsed_at":"2023-01-31T10:01:15.913Z","dependency_job_id":null,"html_url":"https://github.com/code-game-project/go-client","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/code-game-project/go-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-game-project%2Fgo-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-game-project%2Fgo-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-game-project%2Fgo-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-game-project%2Fgo-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/code-game-project","download_url":"https://codeload.github.com/code-game-project/go-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/code-game-project%2Fgo-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338976,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["client","go"],"created_at":"2026-01-12T12:24:06.636Z","updated_at":"2026-01-12T12:24:07.698Z","avatar_url":"https://github.com/code-game-project.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Go-Client\n![CodeGame Version](https://img.shields.io/badge/CodeGame-v0.8-orange)\n![Go version](https://img.shields.io/github/go-mod/go-version/code-game-project/go-client)\n[![GoDoc](https://pkg.go.dev/badge/github.com/code-game-project/go-client)](https://pkg.go.dev/github.com/code-game-project/go-client)\n\nThe Go client library for [CodeGame](https://code-game.org).\n\n## Installation\n\n```sh\ngo get github.com/code-game-project/go-client/cg\n```\n\n## Usage\n\n```go\nsocket, err := cg.Connect(gameURL, gameID, playerID, playerSecret)\nif err != nil {\n  log.Fatalf(\"error: %s\", err)\n}\n\n// Register an event listener for the `test` event.\nsocket.On(TestEvent, func(event cg.Event) {\n\t// TODO: do something with event\n})\n\n// Send a `hello_world` command.\nsocket.Send(HelloWorldCmd, HelloWorldCmdData{\n\tMessage: \"Hello, World!\",\n})\n\n// Start listening for events. Blocks until the connection is closed.\nerr = socket.RunEventLoop()\nif err != nil {\n\tlog.Fatalf(\"error: %s\", err)\n}\n\n// ======= ALTERNATIVELY =======\n\n// manual event loop\nfor {\n\t// NextEvent returns the next event in the queue or ok = false if there is none.\n\t// Registered event listeners will be triggered.\n\t// event -\u003e The polled event. Only valid if ok == true.\n\t// ok -\u003e Whether there was an event in the queue\n\t// err -\u003e cg.ErrClosed if closed.\n\tevent, ok, err := socket.NextEvent()\n\tif err != nil {\n\t\tif err != cg.ErrClosed {\n\t\t\tlog.Fatalf(\"error: %s\", err)\n\t\t}\n\t\tbreak\n\t}\n\tif ok {\n\t\t// do something with event\n\t}\n}\n```\n\n## License\n\nMIT License\n\nCopyright (c) 2022-2023 Julian Hofmann\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-game-project%2Fgo-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcode-game-project%2Fgo-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcode-game-project%2Fgo-client/lists"}