{"id":17205268,"url":"https://github.com/lonng/starx","last_synced_at":"2025-12-15T12:46:49.640Z","repository":{"id":41321964,"uuid":"52653199","full_name":"lonng/starx","owner":"lonng","description":"[DEPRECATED] Lightweight, scalable ,distributed game server framework for Golang","archived":false,"fork":false,"pushed_at":"2017-08-07T02:57:38.000Z","size":793,"stargazers_count":302,"open_issues_count":5,"forks_count":46,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-27T01:12:20.467Z","etag":null,"topics":["deprecated","deprecated-repo"],"latest_commit_sha":null,"homepage":"","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/lonng.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":"2016-02-27T06:15:20.000Z","updated_at":"2024-10-16T09:49:57.000Z","dependencies_parsed_at":"2022-07-31T04:37:54.455Z","dependency_job_id":null,"html_url":"https://github.com/lonng/starx","commit_stats":null,"previous_names":["chrislonng/starx","lonnng/starx"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fstarx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fstarx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fstarx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lonng%2Fstarx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lonng","download_url":"https://codeload.github.com/lonng/starx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248695300,"owners_count":21146952,"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":["deprecated","deprecated-repo"],"created_at":"2024-10-15T02:24:46.068Z","updated_at":"2025-12-15T12:46:49.551Z","avatar_url":"https://github.com/lonng.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DEPRECATED\r\n\r\n***Do not use in a production environment***, new project ref: https://github.com/lonnng/nano/\r\n\r\n# ~~~Starx -- golang based game server framework~~~\r\n\r\nInspired by [Pomelo](https://github.com/NetEase/pomelo), rewrite with golang.\r\n\r\n## Client Library\r\n\r\n- Javascript\r\n  + [starx-client-websockt](https://github.com/lonnng/starx-client-websockt)\r\n\r\n- C#\r\n  + [starx-client-dotnet](https://github.com/lonnng/starx-client-dotnet)\r\n\r\n## Chat Room Demo\r\nimplement a chat room in 100 lines with golang and websocket [starx-chat-demo](https://github.com/lonnng/starx-chat-demo)\r\n\r\n- server\r\n  ```\r\n  package main\r\n  \r\n  import (\r\n  \t\"github.com/lonnng/starx\"\r\n  \t\"github.com/lonnng/starx/component\"\r\n  \t\"github.com/lonnng/starx/serialize/json\"\r\n  \t\"github.com/lonnng/starx/session\"\r\n  )\r\n  \r\n  type Room struct {\r\n  \tcomponent.Base\r\n  \tchannel *starx.Channel\r\n  }\r\n  \r\n  type UserMessage struct {\r\n  \tName    string `json:\"name\"`\r\n  \tContent string `json:\"content\"`\r\n  }\r\n  \r\n  type JoinResponse struct {\r\n  \tCode   int    `json:\"code\"`\r\n  \tResult string `json:\"result\"`\r\n  }\r\n  \r\n  func NewRoom() *Room {\r\n  \treturn \u0026Room{\r\n  \t\tchannel: starx.ChannelService.NewChannel(\"room\"),\r\n  \t}\r\n  }\r\n  \r\n  func (r *Room) Join(s *session.Session, msg []byte) error {\r\n  \ts.Bind(s.ID)     // binding session uid\r\n  \tr.channel.Add(s) // add session to channel\r\n  \treturn s.Response(JoinResponse{Result: \"sucess\"})\r\n  }\r\n  \r\n  func (r *Room) Message(s *session.Session, msg *UserMessage) error {\r\n  \treturn r.channel.Broadcast(\"onMessage\", msg)\r\n  }\r\n  \r\n  func main() {\r\n  \tstarx.SetAppConfig(\"configs/app.json\")\r\n\t  starx.SetServersConfig(\"configs/servers.json\")\r\n  \tstarx.Register(NewRoom())\r\n  \r\n  \tstarx.SetServerID(\"demo-server-1\")\r\n  \tstarx.SetSerializer(json.NewJsonSerializer())\r\n  \tstarx.Run()\r\n  }\r\n\r\n  ```\r\n  \r\n- client\r\n  ```\r\n  \u003c!DOCTYPE html\u003e\r\n  \u003chtml lang=\"en\"\u003e\r\n  \u003chead\u003e\r\n      \u003cmeta charset=\"UTF-8\"\u003e\r\n      \u003ctitle\u003eChat Demo\u003c/title\u003e\r\n  \u003c/head\u003e\r\n  \u003cbody\u003e\r\n  \u003cdiv id=\"container\"\u003e\r\n      \u003cul\u003e\r\n          \u003cli v-for=\"msg in messages\"\u003e[\u003cspan style=\"color:red;\"\u003e{{msg.name}}\u003c/span\u003e]{{msg.content}}\u003c/li\u003e\r\n      \u003c/ul\u003e\r\n      \u003cdiv class=\"controls\"\u003e\r\n          \u003cinput type=\"text\" v-model=\"nickname\"\u003e\r\n          \u003cinput type=\"text\" v-model=\"inputMessage\"\u003e\r\n          \u003cinput type=\"button\" v-on:click=\"sendMessage\" value=\"Send\"\u003e\r\n      \u003c/div\u003e\r\n  \u003c/div\u003e\r\n  \u003cscript src=\"http://cdnjs.cloudflare.com/ajax/libs/vue/1.0.26/vue.min.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\r\n  \u003c!--[starx websocket library](https://github.com/lonnng/starx-client-websocket)--\u003e\r\n  \u003cscript src=\"protocol.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\r\n  \u003cscript src=\"starx-wsclient.js\" type=\"text/javascript\"\u003e\u003c/script\u003e\r\n  \u003cscript\u003e\r\n      var v = new Vue({\r\n          el: \"#container\",\r\n          data: {\r\n              nickname:'guest' + Date.now(),\r\n              inputMessage:'',\r\n              messages: []\r\n          },\r\n          methods: {\r\n              sendMessage: function () {\r\n                  starx.notify('Room.Message', {name: this.nickname, content: this.inputMessage});\r\n                  this.inputMessage = '';\r\n              }\r\n          }\r\n      });\r\n  \r\n      var onMessage = function (msg) {\r\n          v.messages.push(msg)\r\n      };\r\n  \r\n      var join = function (data) {\r\n          if(data.code == 0) {\r\n              v.messages.push({name:'system', content:data.result});\r\n              starx.on('onMessage', onMessage)\r\n          }\r\n      };\r\n  \r\n      starx.init({host: '127.0.0.1', port: 3250}, function () {\r\n          starx.request(\"Room.Join\", {}, join);\r\n      })\r\n  \u003c/script\u003e\r\n  \u003c/body\u003e\r\n  \u003c/html\u003e\r\n  ```\r\n\r\n## Demo\r\n\r\n- Client: [starx-demo-unity](https://github.com/lonnng/starx-demo-unity)\r\n\r\n- Server: [starx-demo-server](https://github.com/lonnng/starx-demo-server)\r\n\r\n## Wiki\r\n\r\n[Homepage](docs/homepage.md)\r\n\r\n## The MIT License\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\r\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\r\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\r\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\r\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\r\nTHE SOFTWARE.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonng%2Fstarx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flonng%2Fstarx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flonng%2Fstarx/lists"}