{"id":50325987,"url":"https://github.com/whyiyhw/gws","last_synced_at":"2026-05-29T06:03:35.370Z","repository":{"id":144633898,"uuid":"260186736","full_name":"whyiyhw/gws","owner":"whyiyhw","description":"Process websocket through aop's ideas, supported by golang","archived":false,"fork":false,"pushed_at":"2025-03-22T12:36:25.000Z","size":77,"stargazers_count":17,"open_issues_count":0,"forks_count":6,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T13:31:56.114Z","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/whyiyhw.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}},"created_at":"2020-04-30T10:55:18.000Z","updated_at":"2025-03-22T12:31:30.000Z","dependencies_parsed_at":"2023-12-23T08:30:27.848Z","dependency_job_id":"6ccbe96f-3809-4a30-b16c-b54c62c2f156","html_url":"https://github.com/whyiyhw/gws","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/whyiyhw/gws","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyiyhw%2Fgws","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyiyhw%2Fgws/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyiyhw%2Fgws/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyiyhw%2Fgws/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whyiyhw","download_url":"https://codeload.github.com/whyiyhw/gws/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whyiyhw%2Fgws/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33536654,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"ssl_error","status_checked_at":"2026-05-26T15:22:15.568Z","response_time":63,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["golang","websocket"],"created_at":"2026-05-29T06:03:32.498Z","updated_at":"2026-05-29T06:03:35.366Z","avatar_url":"https://github.com/whyiyhw.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `gws` 为一个基于事件与切面编程思想所实现的一个基础框架\n\n- 项目灵感来源 `swoole`  \n- 感谢 `github.com/gorilla/websocket` 为本项目提供 `webSocket` 服务 所需的基础\n\n## `v0.0.1` 版本的目标\n\n- ~~能接受单个连接的消息与给单个连接发送消息~~\n- ~~能感知当前连接的总数量~~\n- ~~连接成员间能相互传递消息~~\n- ~~能通过 `http` 请求给对应连接的成员发送消息~~\n\n## 怎么使用？\n\n- 我使用 `go mod` 作为包管理工具\n- 在 `go.mod` 中 加入 `github.com/whyiyhw/gws` 或者 `go get github.com/whyiyhw/gws`\n\n```go\n    // default 127.0.0.1:9501/ws\n\ts := new(gws.Server)\n\n    // 接收消息事件\n\ts.OnMessage = func(c *gws.Conn, fd int, msg string, err error) {\n\t\tfmt.Printf(\"client %d said %s \\n\", fd, message)\n\t}\n\n    // 连接成功事件\n\ts.OnOpen = func(c *gws.Conn, fd int) {\n\t\tfmt.Printf(\"client %d online \\n\", fd)\n\t}\n\n    // 连接关闭事件\n\ts.OnClose = func(c *gws.Conn, fd int) {\n\t\tfmt.Printf(\"client %d had offline \\n\", fd)\n\t}\n\n    // 启动服务\n\tif err := s.ListenAndServe(); err != nil {\n\t\tpanic(err)\n\t}\n```\n\n- 再使用 浏览器工具栏 连接 `ws://127.0.0.1:9501/ws` 就可以愉快的玩耍了~\n\n## 其它 特性请查看 examples 自行测试~\n\n`v0.0.2` 版本\n\n- 修复主动关闭时未触发关闭事件的 Bug\n- 增加通用的消息推送架构设计图\n- ![websocket](examples/websocket.png)\n\n`v0.0.3` 版本 依赖升级，补充了小型项目可直接使用的demo\n\n都看到这里了 给个 💖 吧\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyiyhw%2Fgws","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhyiyhw%2Fgws","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhyiyhw%2Fgws/lists"}