{"id":21870431,"url":"https://github.com/next-dev-team/gameserver","last_synced_at":"2025-08-20T16:20:46.427Z","repository":{"id":41325162,"uuid":"509143892","full_name":"next-dev-team/gameserver","owner":"next-dev-team","description":"This is sample starter build on leaf framework","archived":false,"fork":false,"pushed_at":"2022-07-04T10:57:48.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-03-21T22:22:18.299Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/next-dev-team.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":"2022-06-30T15:55:42.000Z","updated_at":"2022-06-30T15:56:55.000Z","dependencies_parsed_at":"2022-08-24T18:01:00.993Z","dependency_job_id":null,"html_url":"https://github.com/next-dev-team/gameserver","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/next-dev-team/gameserver","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/next-dev-team%2Fgameserver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/next-dev-team%2Fgameserver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/next-dev-team%2Fgameserver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/next-dev-team%2Fgameserver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/next-dev-team","download_url":"https://codeload.github.com/next-dev-team/gameserver/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/next-dev-team%2Fgameserver/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266633053,"owners_count":23959467,"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","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2024-11-28T06:11:23.873Z","updated_at":"2025-07-23T07:03:11.331Z","avatar_url":"https://github.com/next-dev-team.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"game serve based on Leaf server framework\n===========\nA game server based on [Leaf framework](https://github.com/name5566/leaf).\n\n```\nimport React, { useEffect, useState } from \"react\";\nimport \"./App.css\";\nimport { number } from \"decoders\";\nimport { Select } from \"antd\";\nconst { Option } = Select;\nfunction App() {\n  const [data, setData] = useState({});\n  const [ws, setWebsocket] = useState\u003cWebSocket\u003e();\n  const [isGameStarted, setIsGameStated] = useState(false);\n  useEffect(() =\u003e {\n    const ws = new WebSocket(\"ws://127.0.0.1:3654\");\n    setWebsocket(ws);\n    ws.binaryType = \"arraybuffer\";\n    ws.onopen = (event) =\u003e {\n      // Send Hello message\n      ws.send(\n        JSON.stringify({\n          Hello: {\n            Name: \"Sinak\",\n          },\n        })\n      );\n    };\n\n    ws.onmessage = function (e) {\n      console.log(\"event:\", e?.data?.size);\n      var decoder = new window.TextDecoder(\"utf-8\");\n      var result = JSON.parse(decoder.decode(e.data));\n      console.log(result);\n      setData(result);\n    };\n  }, []);\n  useEffect(()=\u003e{\n    ws?.send(\n      JSON.stringify({\n        GameState: {\n          status: isGameStarted? 2:1,\n        },\n      })\n    );\n  },[isGameStarted])\n\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003ch3\u003eGet started with web socket\u003c/h3\u003e\n      \u003ch4\u003eReady to guess!!\u003c/h4\u003e\n      \u003cpre\u003e{JSON.stringify(data)}\u003c/pre\u003e\n     \n      \u003cbr /\u003e\n      \u003cbutton\n        onClick={() =\u003e {\n          setIsGameStated(!isGameStarted);\n          ws?.send(\n            JSON.stringify({\n              GameState: {\n                status: 1,\n              },\n            })\n          );\n        }}\n      \u003e\n        {!isGameStarted ? \"Start Game\" : \"Stop Game\"}\n      \u003c/button\u003e\n      {isGameStarted \u0026\u0026 (\n        \u003c\u003e\n        \u003cbutton\n          style={{ marginLeft: \"10px\" }}\n          onClick={() =\u003e {\n            ws?.send(\n              JSON.stringify({\n                GuessGame: {\n                  text: \"big\",\n                },\n              })\n            );\n         \n          }}\n        \u003e\n          Big\n        \u003c/button\u003e\n        \u003cbutton\n          style={{ marginLeft: \"10px\" }}\n          onClick={() =\u003e {\n            ws?.send(\n              JSON.stringify({\n                GuessGame: {\n                  text: \"small\",\n                },\n              })\n            );\n         \n          }}\n        \u003e\n          Small\n        \u003c/button\u003e\n        \u003c/\u003e\n      )}\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n\n```\n\nLicensing\n---------\n\nLeaf server is licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/name5566/leafserver/blob/master/LICENSE) for the full license text.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnext-dev-team%2Fgameserver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnext-dev-team%2Fgameserver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnext-dev-team%2Fgameserver/lists"}