{"id":17325777,"url":"https://github.com/devfeel/connx","last_synced_at":"2025-06-10T14:11:08.487Z","repository":{"id":81386693,"uuid":"137851025","full_name":"devfeel/connx","owner":"devfeel","description":"A simple tcp server/client go framework.","archived":false,"fork":false,"pushed_at":"2018-07-24T06:21:02.000Z","size":13,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-21T17:45:52.277Z","etag":null,"topics":["client","conn","connection","go","golang","server","tcp"],"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/devfeel.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,"zenodo":null}},"created_at":"2018-06-19T06:44:28.000Z","updated_at":"2022-06-01T18:02:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"214bbf19-3bea-4607-9079-c0838fa470b3","html_url":"https://github.com/devfeel/connx","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfeel%2Fconnx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfeel%2Fconnx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfeel%2Fconnx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfeel%2Fconnx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devfeel","download_url":"https://codeload.github.com/devfeel/connx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devfeel%2Fconnx/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259089057,"owners_count":22803671,"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":["client","conn","connection","go","golang","server","tcp"],"created_at":"2024-10-15T14:14:17.700Z","updated_at":"2025-06-10T14:11:08.462Z","avatar_url":"https://github.com/devfeel.png","language":"Go","readme":"## devfeel/connx\nA simple tcp server/client go framework.\n\n## Feature:\n* 极其简单的使用代码\n* 经典Server/Client模式\n* 解决经典粘包问题\n* Server支持主动关闭\n* Client支持Send+Write\\OnlySend模式\n* 提供默认的Message协议，自包含版本、命令、数据，应用可直接使用\n* 支持自定义HeadFlag设定，用于验证消息头\n\n## Code:\n#### server code:\n```go\nfunc main(){\n\tserver, err := connx.NewServer(\"127.0.0.1:7069\", onConnHandler)\n\tif err != nil{\n\t\tfmt.Println(\"GetNewServer error\", err)\n\t\treturn\n\t}\n\tfmt.Println(\"GetNewServer begin listen\")\n\tserver.Start()\n}\n\n\nfunc onConnHandler(conn *connx.Connection) error{\n\tmsg, err := conn.ParseMessage()\n\tfmt.Println(msg, err)\n\n\tmsgReply := connx.ResponseMessage(\"echo ok\")\n\tconn.SendMessage(msgReply)\n\treturn nil\n}\n```\n#### client code:\n```go\nfunc main(){\n\tclient := connx.NewClient(\"127.0.0.1:7069\", onConnHandler)\n\tgo func(){\n\t\tfor{\n\t\t\terr := client.Send(connx.RequestMessage(\"test client\"))\n\t\t\tif err != nil{\n\t\t\t\tfmt.Println(\"Send login message failed\", err)\n\t\t\t}else{\n\t\t\t\tfmt.Println(\"Send login message success\")\n\t\t\t}\n\t\t\ttime.Sleep(time.Second*10)\n\t\t}\n\t}()\n\n\tfor{\n\t\tselect{}\n\t}\n}\n\nfunc onConnHandler(conn *connx.Connection) error{\n\tmsg, err := conn.ParseMessage()\n\tfmt.Println(msg, err)\n\treturn nil\n}\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfeel%2Fconnx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevfeel%2Fconnx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevfeel%2Fconnx/lists"}