{"id":20681233,"url":"https://github.com/flxxyz/blue","last_synced_at":"2025-08-24T17:07:10.333Z","repository":{"id":57604997,"uuid":"196985146","full_name":"flxxyz/blue","owner":"flxxyz","description":"基于gorilla/websocket构建的微型websocket框架","archived":false,"fork":false,"pushed_at":"2019-07-18T06:14:50.000Z","size":13,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-17T15:51:13.065Z","etag":null,"topics":["go","golang","golang-library","websocket"],"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/flxxyz.png","metadata":{"files":{"readme":"README.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}},"created_at":"2019-07-15T11:25:26.000Z","updated_at":"2019-07-18T06:14:52.000Z","dependencies_parsed_at":"2022-09-26T20:01:12.884Z","dependency_job_id":null,"html_url":"https://github.com/flxxyz/blue","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fblue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fblue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fblue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flxxyz%2Fblue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flxxyz","download_url":"https://codeload.github.com/flxxyz/blue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242926225,"owners_count":20207754,"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":["go","golang","golang-library","websocket"],"created_at":"2024-11-16T22:10:17.176Z","updated_at":"2025-03-10T20:42:18.568Z","avatar_url":"https://github.com/flxxyz.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blue\n基于[gorilla/websocket](https://github.com/gorilla/websocket)构建的微型websocket框架\n\nps: 为什么叫这个名字呢，因为最近在听[the blue hearts](https://zh.wikipedia.org/zh/THE_BLUE_HEARTS)这个乐队\n\n## 依赖要求\n没有\n\n## 安装\n使用`go`命令获取类库\n\n```bash\ngo get github.com/flxxyz/blue\n```\n\n## 例子\n\n### net/http\n```go\npackage main\n\nimport (\n    \"bytes\"\n    \"github.com/flxxyz/blue\"\n    \"log\"\n    \"net/http\"\n)\n\nfunc main() {\n    heart := blue.NewHeart()\n    heart.HandlerMessage(func(c *blue.Client, data *bytes.Buffer) {\n        heart.Broadcast(data)\n        log.Printf(\"[%s] body: %s\", c.ID.String(), data.String())\n    })\n    \n    http.HandleFunc(\"/\", heart.ServeHTTP)\n    if err := http.ListenAndServe(\":7777\", nil); err == nil {\n        log.Fatal(\"GG\")\n    }\n}\n```\n\n### gin\n```go\npackage main\n\nimport (\n    \"bytes\"\n    \"github.com/flxxyz/blue\"\n    \"github.com/gin-gonic/gin\"\n    \"log\"\n)\n\nfunc main() {\n    heart := blue.NewHeart()\n    heart.HandlerMessage(func(c *blue.Client, data *bytes.Buffer) {\n        heart.Broadcast(data)\n        log.Printf(\"[%s] body: %s\", c.ID.String(), data.String())\n    })\n    \n    gin.SetMode(gin.ReleaseMode)\n    r := gin.Default()\n    r.GET(\"/\", func(c *gin.Context) {\n        heart.ServeHTTP(c.Writer, c.Request)\n    })\n    r.Run(\":7777\")\n}\n```\n\n## 文档\n[文档点这里](http://godoc.org/github.com/flxxyz/blue)\n\n## 版权\nblue包在MIT License下发布。有关详细信息，请参阅LICENSE。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxxyz%2Fblue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflxxyz%2Fblue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflxxyz%2Fblue/lists"}