{"id":46748247,"url":"https://github.com/ramzeng/ramix","last_synced_at":"2026-03-09T20:18:12.796Z","repository":{"id":180011799,"uuid":"661662770","full_name":"ramzeng/ramix","owner":"ramzeng","description":"A lightweight TCP Server framework based on Golang.","archived":false,"fork":false,"pushed_at":"2024-07-29T05:42:56.000Z","size":77,"stargazers_count":24,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-29T07:08:08.285Z","etag":null,"topics":["framework","go","golang","tcp"],"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/ramzeng.png","metadata":{"files":{"readme":"README-CN.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-07-03T11:20:17.000Z","updated_at":"2024-07-29T05:43:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"76a8ceea-40f2-4892-ac2c-cc8fc1b34f36","html_url":"https://github.com/ramzeng/ramix","commit_stats":null,"previous_names":["ranpro/ramix","ramzeng/ramix"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/ramzeng/ramix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzeng%2Framix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzeng%2Framix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzeng%2Framix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzeng%2Framix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ramzeng","download_url":"https://codeload.github.com/ramzeng/ramix/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ramzeng%2Framix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30310294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T20:05:46.299Z","status":"ssl_error","status_checked_at":"2026-03-09T19:57:04.425Z","response_time":61,"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":["framework","go","golang","tcp"],"created_at":"2026-03-09T20:18:12.166Z","updated_at":"2026-03-09T20:18:12.775Z","avatar_url":"https://github.com/ramzeng.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ramix\n[![Go Reference](https://pkg.go.dev/badge/github.com/ramzeng/ramix.svg)](https://pkg.go.dev/github.com/ramzeng/ramix)\n![Lint](https://github.com/ramzeng/ramix/actions/workflows/golangci-lint.yml/badge.svg)\n\n## 介绍\n**简体中文** | [English](https://github.com/ramzeng/ramix/blob/main/README.md)\n\n一款基于 Golang 的轻量级 TCP Server 框架\n## 结构\n![image](https://github.com/ramzeng/ramix/assets/38133602/f736a468-094b-4a7c-bf23-9ea956fc063a)\n## 能力\n- [x] 消息路由\n- [x] 路由分组\n- [x] 路由中间件\n- [x] 消息编解码\n- [x] 消息处理队列\n- [x] 消息读写分离\n- [x] 连接心跳检测\n- [x] Hooks\n- [x] 日志能力\n- [x] TLS 支持\n- [x] WebSocket Support\n## TODO\n- [ ] 单元测试\n## 安装\n```bash\ngo get -u github.com/ramzeng/ramix\n```\n## 快速开始\n### 服务端\n```go\npackage main\n\nimport (\n\t\"github.com/ramzeng/ramix\"\n\t\"time\"\n)\n\nfunc main() {\n\tramix.SetMode(ramix.DebugMode)\n\n\tserver := ramix.NewServer(\n\t\tramix.WithPort(8899),\n\t)\n\n\tserver.UseWorkerPool(ramix.NewRoundRobinWorkerPool(100, 1024))\n\tserver.Use(ramix.Recovery(), ramix.Logger())\n\n\tserver.RegisterRoute(0, func(context *ramix.Context) {\n\t\t_ = context.Connection.SendMessage(context.Request.Message.Event, []byte(\"pong\"))\n\t})\n\n\tserver.Serve()\n}\n```\n### 客户端\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/ramzeng/ramix\"\n\t\"net\"\n\t\"time\"\n)\n\nfunc main() {\n\tsocket, err := net.Dial(\"tcp4\", \"127.0.0.1:8899\")\n\n\tif err != nil {\n\t\tfmt.Println(\"Dial error: \", err)\n\t\treturn\n\t}\n\n\tencoder := ramix.Encoder{}\n\tdecoder := ramix.Decoder{}\n\n\tfor {\n\t\tmessage := ramix.Message{\n\t\t\tEvent: 0,\n\t\t\tBody:  []byte(\"ping\"),\n\t\t}\n\n\t\tmessage.BodySize = uint32(len(message.Body))\n\n\t\tencodedMessage, err := encoder.Encode(message)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Encode error: \", err)\n\t\t\treturn\n\t\t}\n\n\t\t_, err = socket.Write(encodedMessage)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Write error: \", err)\n\t\t\treturn\n\t\t}\n\n\t\tbuffer := make([]byte, 1024)\n\n\t\t_, err = socket.Read(buffer)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Read error: \", err)\n\t\t\treturn\n\t\t}\n\n\t\tmessage, err = decoder.Decode(buffer)\n\n\t\tif err != nil {\n\t\t\tfmt.Println(\"Decode error: \", err)\n\t\t\treturn\n\t\t}\n\n\t\tfmt.Printf(\"Server message: %s\\n\", message.Body)\n\n\t\ttime.Sleep(time.Second)\n\t}\n}\n```\n## 由 JetBrains 赞助\n\n非常感谢 Jetbrains 为我提供的 IDE 开源许可，让我完成此项目和其他开源项目上的开发工作。\n\n[![](https://resources.jetbrains.com/storage/products/company/brand/logos/jb_beam.svg)](https://www.jetbrains.com/?from=https://github.com/ramzeng)\n\n## 协议\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framzeng%2Framix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Framzeng%2Framix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Framzeng%2Framix/lists"}