{"id":19765664,"url":"https://github.com/cold-bin/mini-websocket","last_synced_at":"2025-10-09T23:32:53.946Z","repository":{"id":57751472,"uuid":"517913585","full_name":"cold-bin/mini-websocket","owner":"cold-bin","description":"websocket框架","archived":false,"fork":false,"pushed_at":"2022-07-27T05:05:54.000Z","size":29,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-09T23:32:40.621Z","etag":null,"topics":["golang","websocket"],"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/cold-bin.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-07-26T04:34:41.000Z","updated_at":"2022-07-26T11:05:26.000Z","dependencies_parsed_at":"2022-08-26T09:30:57.933Z","dependency_job_id":null,"html_url":"https://github.com/cold-bin/mini-websocket","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cold-bin/mini-websocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cold-bin%2Fmini-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cold-bin%2Fmini-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cold-bin%2Fmini-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cold-bin%2Fmini-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cold-bin","download_url":"https://codeload.github.com/cold-bin/mini-websocket/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cold-bin%2Fmini-websocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002311,"owners_count":26083340,"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-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["golang","websocket"],"created_at":"2024-11-12T04:18:50.765Z","updated_at":"2025-10-09T23:32:53.931Z","avatar_url":"https://github.com/cold-bin.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mini-websocket\nwebsocket framework\n### go version\n\u003e go 1.17+\n### function \n- [x] 序列化和反序列化帧\n- [x] 握手与挥手\n- [x] 良好的封装\n- [x] 心跳api \n- [x] 数据分片传输\n- [x] 跨域处理\n- [ ] 压缩\n\n### start\n```shell\ngo get -u github.com/cold-bin/mini-websocket\n```\n### 使用示例\n\n```go\n// @author cold bin\n// @date 2022/7/25\n\npackage mini_websocket\n\nimport (\n\t\"log\"\n\t\"net/http\"\n\n\twebsocket \"github.com/cold-bin/mini-websocket\"\n)\n\nfunc main() {\n\thttp.HandleFunc(\"/ws\", func(w http.ResponseWriter, r *http.Request) {\n\t\twsConn, err := websocket.DefaultUpGrader.UpGrade(c.Req, c.Writer)\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t\treturn\n\t\t}\n\t\twsConn.SendMessage(\"欢迎使用本websocket连接\") //当前为server端，不会做掩码处理\n\n\t\tfor {\n\t\t\t_, bytes, err := wsConn.ReadMessage()\n\t\t\tif err != nil {\n\t\t\t\tlog.Println(err)\n\t\t\t\treturn\n\t\t\t}\n\n\t\t\twsConn.SendMessage(string(bytes))\n\t\t}\n\t})\n\n\terr := http.ListenAndServe(\":8080\", nil)\n\tif err != nil {\n\t\tlog.Println(err)\n\t\treturn\n\t}\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcold-bin%2Fmini-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcold-bin%2Fmini-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcold-bin%2Fmini-websocket/lists"}