{"id":45174521,"url":"https://github.com/xkeyideal/grpcwatch","last_synced_at":"2026-02-20T09:08:49.258Z","repository":{"id":41110849,"uuid":"243189503","full_name":"xkeyideal/grpcwatch","owner":"xkeyideal","description":"grpc-go watch stream example","archived":false,"fork":false,"pushed_at":"2020-03-04T07:29:49.000Z","size":63,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T02:10:37.671Z","etag":null,"topics":["grpc","grpc-go","grpc-stream","watcher"],"latest_commit_sha":null,"homepage":"","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/xkeyideal.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-02-26T06:52:02.000Z","updated_at":"2023-12-01T16:13:25.000Z","dependencies_parsed_at":"2022-08-28T22:30:26.901Z","dependency_job_id":null,"html_url":"https://github.com/xkeyideal/grpcwatch","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/xkeyideal/grpcwatch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fgrpcwatch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fgrpcwatch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fgrpcwatch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fgrpcwatch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xkeyideal","download_url":"https://codeload.github.com/xkeyideal/grpcwatch/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xkeyideal%2Fgrpcwatch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29646636,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T08:48:14.886Z","status":"ssl_error","status_checked_at":"2026-02-20T08:45:26.777Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["grpc","grpc-go","grpc-stream","watcher"],"created_at":"2026-02-20T09:08:48.507Z","updated_at":"2026-02-20T09:08:49.250Z","avatar_url":"https://github.com/xkeyideal.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"## gRPC watch\n\n本项目是参考[Etcd](https://github.com/etcd-io/etcd) 的watch client实现的常规业务的简易化watch 用例.\n\n### watchclient目录\n\ngRPC watch 的客户端核心程序，代码里有比较详细的中文注释，实现的功能：\n\n1. 断线重连\n2. gRPC stream 管理\n3. 错误处理\n\n核心功能都是参考Etcd的 clientv3/watch.go 中代码实现。\n\n### watchserver目录\n\ngRPC watch 的服务端核心程序，用于mock数据，代码比较简单。\n\n示例中的代码，只采用了定时的方式固定生成数据，然后通过gRPC server stream发送给客户端。\n在实际的应用场景中，需要与实际的数据存储程序关联在一起，此处的处理逻辑较为复杂，本例未详细实现，\n可参考[Etcd watch server](https://github.com/etcd-io/etcd/blob/master/mvcc/watcher.go)代码。\n\n### grpclient 目录\n\ngRPC client的负载均衡与分布式锁、选主的封装。\n\n此部分代码也是基于Etcd的clientv3代码中修改。\n\n负载均衡代码只适用于 gRPC 1.24.0版本，现有的1.27.+版本由于API的变化，导致不能使用，后续修改。\n\n### 测试代码 test目录\n\n1. go run server.go, 启动服务端\n2. go run client.go, 启动客户端\n   \n服务端与客户端测试代码比较简单，可以根据自己需求修改，测试各类功能。\n\n### 备注\n\n由于个人能力有限，此用例中可能存在若干bug，还请鉴别使用。\n\n最后给出 [gRPC Codes](https://github.com/xkeyideal/grpcwatch/blob/master/grpcodes.md)的个人理解，仅供参考。","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkeyideal%2Fgrpcwatch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxkeyideal%2Fgrpcwatch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxkeyideal%2Fgrpcwatch/lists"}