{"id":15162047,"url":"https://github.com/liangjfblue/gpusher","last_synced_at":"2026-01-21T16:36:38.329Z","repository":{"id":57555010,"uuid":"265537992","full_name":"liangjfblue/gpusher","owner":"liangjfblue","description":"push system writen by golang","archived":false,"fork":false,"pushed_at":"2020-09-10T08:57:27.000Z","size":254,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-21T08:46:40.425Z","etag":null,"topics":["distributed-systems","etcdv3","golang","grpc","mysql","push-server","redis"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/liangjfblue.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":"2020-05-20T11:01:43.000Z","updated_at":"2020-09-16T08:43:37.000Z","dependencies_parsed_at":"2022-09-26T18:51:33.551Z","dependency_job_id":null,"html_url":"https://github.com/liangjfblue/gpusher","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/liangjfblue%2Fgpusher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2Fgpusher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2Fgpusher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/liangjfblue%2Fgpusher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/liangjfblue","download_url":"https://codeload.github.com/liangjfblue/gpusher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755561,"owners_count":20990621,"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":["distributed-systems","etcdv3","golang","grpc","mysql","push-server","redis"],"created_at":"2024-09-27T01:04:20.908Z","updated_at":"2026-01-21T16:36:38.287Z","avatar_url":"https://github.com/liangjfblue.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gpusher\n\n## 模块\n- gateway\n- logic\n- message\n- web\n\n## 模块功能\n### gateway(网关)\n- 维护与client的连接, 转发消息到logic处理\n- 接收logic的下发推送消息, 发送给client\n- 保存连接信息, 负载情况到redis, 提供web模块http查询\n\n### logic(逻辑服)\n- 接收网络的客户端转发消息, 处理消息, 判断转发关系(转发给另外哪个client)\n- 监听web推送到消息队列的消息, 判断推送消息的下发路由关系(下发给哪个网关)\n- 保存client与网关的路由关系(rpc调用message的接口) \n\n### message(数据层)\n- 提供rpc接口\n- 保存client与网关的路由关系\n- 提供获取client与网关的路由关系\n- 保存离线消息\n- 提供获取离线消息\n\n### web(web服务)\n- 提供RESTful接口\n- 提供推送消息接口\n- 获取系统信息接口(读取redis)\n- 管理员操作(推送消息, 删除消息, 查看分析等)\n\n\n### 服务启动流程\n- 1.启动message服\n- 2.启动logic服\n- 3.启动web服务\n- 4.启动gateway\n\n\n### gpusher使用\n#### 本地启动\n- 1.启动 message, logic, web, gateway\n- 2.启动 test/client, 测试连接 gpusher\n- 3.推送消息 http://ip:port/v1/push\n\n#### 容器化启动\n##### 镜像打包\n./script/build-docker.sh\n\n##### 运行各个服务的容器\ndocker run --rm -t -p 7780:7780 --net=host gpusher-message\ndocker run --rm -t -p 7771:7771 -p 8881:8881 --net=host gpusher-gateway\ndocker run --rm -t -p 7772:7772 --net=host gpusher-logic\ndocker run --rm -t -p 7030:7030 --net=host gpusher-web\n\n\n### 客户端连接网关\n    client--\u003egateway\n\n\n### logic grpc长连接所有网关\n          --\u003egateway1\n    logic --\u003egateway2\n          --\u003egateway3\n\n\n### 消息推送流程\n    web--\u003ekafka--\u003elogic         --\u003egateway--\u003eclient\n                       -\u003emessage\n     \n     \n### watch etcd service list\n                 \n    etcdctl --endpoints \"http://172.16.7.16:9002,http://172.16.7.16:9004,http://172.16.7.16:9006\" watch /etcd/gpusher --prefix\n\n\n\n### 消息格式\n```http://ip:port/v1/push```\n\n    {\n        \"tag\":\"app_gpusher\",\n        \"body\": {\n            \"type\":1,\n            \"uuid\":\"liangjf\",\n            \"content\":\"hello world 123\",\n            \"expireTime\":3600,\n            \"offlinePush\":false\n        }\n    }\n\n- tag: appName, 也作为topic\n- body: 推送体\n    - type: 推送类型(1-个体推送, 2-app推送, 3-全体推送)\n    - uuid: 推送消息接收者\n    - content: 推送消息内容\n    - expireTime: 推送消息过期时间\n    - offlinePush: 是否离线推送(用户登陆时会拉取离线消息)\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjfblue%2Fgpusher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fliangjfblue%2Fgpusher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fliangjfblue%2Fgpusher/lists"}