{"id":24199816,"url":"https://github.com/ksysoev/rpc-redis","last_synced_at":"2026-03-17T02:49:09.727Z","repository":{"id":247025976,"uuid":"824843880","full_name":"ksysoev/rpc-redis","owner":"ksysoev","description":"a Go package that implements a JSON-RPC-like protocol over Redis Streams and channels. It allows you to build scalable and efficient RPC servers and clients using Redis as the underlying transport mechanism. The package provides a simple API for setting up RPC servers and clients, with flexible handlers for different RPC methods.","archived":false,"fork":false,"pushed_at":"2024-11-19T11:54:20.000Z","size":93,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-11-19T12:53:46.278Z","etag":null,"topics":["golang","jsonrpc","redis","rpc"],"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/ksysoev.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-06T05:25:50.000Z","updated_at":"2024-11-19T11:54:20.000Z","dependencies_parsed_at":"2024-08-10T10:59:38.531Z","dependency_job_id":"94c57bd1-7c1c-46eb-8248-11dcbe1e14bd","html_url":"https://github.com/ksysoev/rpc-redis","commit_stats":null,"previous_names":["ksysoev/redis-rpc"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Frpc-redis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Frpc-redis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Frpc-redis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ksysoev%2Frpc-redis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ksysoev","download_url":"https://codeload.github.com/ksysoev/rpc-redis/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":233807446,"owners_count":18733383,"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":["golang","jsonrpc","redis","rpc"],"created_at":"2025-01-13T20:39:10.659Z","updated_at":"2025-09-21T23:32:13.018Z","avatar_url":"https://github.com/ksysoev.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RPC Redis\n\n[![RPC Redis](https://github.com/ksysoev/rpc-redis/actions/workflows/main.yml/badge.svg)](https://github.com/ksysoev/rpc-redis/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/ksysoev/rpc-redis/graph/badge.svg?token=Q1G80IX95U)](https://codecov.io/gh/ksysoev/rpc-redis)\n\n`rpc-redis` is a Go package that implements a JSON-RPC-like protocol over Redis Streams and channels. This package allows you to build scalable and efficient RPC servers and clients using Redis as the underlying transport mechanism.\n\n## Features\n\n- **JSON-RPC-like Protocol**: Implements a protocol similar to JSON-RPC for seamless integration.\n- **Redis Streams and Channels**: Utilizes Redis Streams and channels for message passing, ensuring high performance and reliability.\n- **Easy to Use**: Simple API for setting up RPC servers and clients.\n- **Flexible Handlers**: Easily add custom handlers for different RPC methods.\n\n## Installation\n\nTo install the package, run:\n\n```sh\ngo get github.com/yourusername/rpc-redis\n```\n\n## RPC Server\n\nBelow is an example of how to set up an RPC server:\n\n```golang\nredisClient := redis.NewClient(\u0026redis.Options{\n    Addr: \"localhost:6379\",\n})\n\nrpcServer := rpc.NewServer(redisClient, \"echo.EchoService\", \"echo-group\", \"echo-consumer\")\n\nrpcServer.AddHandler(\"Echo\", func(req rpc.Request) (any, error) {\n    var echoReq EchoRequest\n    if err := req.ParseParams(\u0026echoReq); err != nil {\n        return nil, fmt.Errorf(\"error parsing request: %v\", err)\n    }\n\n    var stash Stash\n    if err = rpc.ParseStash(req.Context(), \u0026stash); err != nil {\n        return nil, fmt.Errorf(\"error parsing stash: %v\", err)\n    }\n\n    slog.Info(\"Received request: \" + echoReq.Value)\n\n    return \u0026echoReq, nil\n})\n\nslog.Info(\"Starting RPC server\")\nif err := rpcServer.Run(); err != nil {\n    slog.Error(\"Error running RPC server: \" + err.Error())\n}\n\nslog.Info(\"Server stopped\")\n```\n\n## RPC Client\n\nBelow is an example of how to set up an RPC client:\n\n```golang\nredisClient := redis.NewClient(\u0026redis.Options{\n    Addr: \"localhost:6379\",\n})\ndefer redisClient.Close()\n\nrpcClient := rpc.NewClient(redisClient, \"echo.EchoService\")\ndefer rpcClient.Close()\n\nctx := context.Background()\nctx, err := rpc.SetStash(ctx, \u0026Stash{Value: \"Hello, stash!\"})\nif err != nil {\n\tslog.Error(\"Error setting stash: \" + err.Error())\n\treturn\n}\n\nresp, err := rpcClient.Call(ctx, \"Echo\", \u0026EchoRequest{Value: \"Hello, world!\"})\n\nif err != nil {\n    slog.Error(\"Error calling RPC: \" + err.Error())\n    return\n}\n\nvar result EchoRequest\nerr = resp.ParseResut(\u0026result)\nif err != nil {\n    slog.Error(\"Error parsing result: \" + err.Error())\n    return\n}\n\nfmt.Println(result)\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a pull request or open an issue if you encounter any problems or have suggestions for improvements.\n\n\n## License\n\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksysoev%2Frpc-redis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fksysoev%2Frpc-redis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fksysoev%2Frpc-redis/lists"}