{"id":16370808,"url":"https://github.com/integralist/rpcclient","last_synced_at":"2026-03-08T22:30:16.962Z","repository":{"id":140162155,"uuid":"47396093","full_name":"Integralist/rpcclient","owner":"Integralist","description":null,"archived":false,"fork":false,"pushed_at":"2015-12-04T10:34:44.000Z","size":2421,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-12-31T13:43:31.133Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/Integralist.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}},"created_at":"2015-12-04T10:00:44.000Z","updated_at":"2015-12-07T17:03:10.000Z","dependencies_parsed_at":"2023-05-17T12:45:47.674Z","dependency_job_id":null,"html_url":"https://github.com/Integralist/rpcclient","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Integralist%2Frpcclient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Integralist%2Frpcclient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Integralist%2Frpcclient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Integralist%2Frpcclient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Integralist","download_url":"https://codeload.github.com/Integralist/rpcclient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239906771,"owners_count":19716581,"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":[],"created_at":"2024-10-11T03:06:02.555Z","updated_at":"2026-03-08T22:30:16.910Z","avatar_url":"https://github.com/Integralist.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"RPC is a way of connecting two separate services via a raw TCP socket\n\n\u003e Note: SOAP, Thrift, REST APIs, message queues such as RabbitMQ, and key value stores such as Etcd are examples of other tools and protocols\n\n## Credit\n\nCode modified only slightly from https://github.com/haisum/rpcexample\n\n## Basic outline\n\nThe fundamental principle is, you define an RPC service:\n\n- Write a function\n- Add some RPC configuration\n- Register our function as a RPC service\n- Start the service and have it listen for messages on a specific port\n\nFrom here we have a client service that calls the RPC service:\n\n- Write code which calls RPC function\n- Call the function via a specific ip/port\n- The 'message' is passed over as valid JSON\n\n## JSON-RPC\n\nThe client JSON could look like:\n\n- `method`: name of method/service\n- `params`: Array of arguments to be passed\n- `id`: usually an integer; makes it easier for client to know which request it got a response to (if the RPC calls are done asynchroneously)\n \n```json\n{\"method\": \"Arith.Multiply\", \"params\": [{\"A\": 2, \"B\": 3}], \"id\": 1}\n```\n\nThe RPC server JSON response could look like:\n\n- `result`: contains return value of method called (`null` if error ocurred)\n- `error`: if error occurred, indicates error code or error message, otherwise `null`\n- `id`: the id of the request it is responding to\n\n```json\n{\"result\": 6, \"error\": null, \"id\": 1}\n```\n\nTo run the example code in this repo you'll need both:\n\n- https://github.com/Integralist/rpcremote\n- https://github.com/Integralist/rpcclient\n\nIn the remote repo run:\n\n```bash\ngo run rpcremote/server.go\n2015/12/04 10:25:29 Serving RPC handler\n```\n\nIn the client repo run:\n\n```bash\ngo run rpcclient/client.go\n2015/12/04 10:27:22 2*3=6\n```\n\nThis will trigger a log in the remote:\n\n```bash\n2015/12/04 10:27:22 Multiplying 2 with 3\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegralist%2Frpcclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fintegralist%2Frpcclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fintegralist%2Frpcclient/lists"}