{"id":18290592,"url":"https://github.com/shuai132/esp_rpc","last_synced_at":"2025-04-05T10:30:49.998Z","repository":{"id":124277237,"uuid":"561269103","full_name":"shuai132/esp_rpc","owner":"shuai132","description":"Tiny RPC library for ESP8266/ESP32 based on rpc_core","archived":false,"fork":false,"pushed_at":"2023-09-21T08:04:26.000Z","size":34,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-21T02:51:05.104Z","etag":null,"topics":["arduino","esp32","esp8266","esp8266-arduino","rpc"],"latest_commit_sha":null,"homepage":"","language":"C++","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/shuai132.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-03T10:26:59.000Z","updated_at":"2024-12-24T19:46:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"d6816ce0-9b82-4453-b39b-ea298fe7710f","html_url":"https://github.com/shuai132/esp_rpc","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/shuai132%2Fesp_rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2Fesp_rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2Fesp_rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shuai132%2Fesp_rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shuai132","download_url":"https://codeload.github.com/shuai132/esp_rpc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247324383,"owners_count":20920632,"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":["arduino","esp32","esp8266","esp8266-arduino","rpc"],"created_at":"2024-11-05T14:11:34.245Z","updated_at":"2025-04-05T10:30:49.985Z","avatar_url":"https://github.com/shuai132.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp_rpc\n\na Tiny RPC library for ESP32/ESP8266, and can be ported to any platform easily.\n\nRPC based on [rpc_core](https://github.com/shuai132/rpc_core)\n\n## Requirements\n\n* C++11\n\n* implement\n\n```c++\nnamespace esp_rpc {\nvoid dispatch(std::function\u003cvoid()\u003e runnable) {\n    // dispatch runnable to main thread looper\n    // because tcp callback may from interrupt or other thread \n}\n\nvoid set_timeout(uint32_t ms, std::function\u003cvoid()\u003e cb) {\n    // timeout implement\n}\n}  // namespace esp_rpc\n```\n\n## Usage\n\n* RPC\n\n```c++\n  // server\n  rpc_server server(8080);\n  server.on_session = [](const std::weak_ptr\u003crpc_session\u003e\u0026 rs) {\n    auto session = rs.lock();\n    session-\u003eon_close = [rs] {\n    };\n    session-\u003erpc-\u003esubscribe(\"cmd\", [](const std::string\u0026 data) -\u003e std::string {\n      return \"world\";\n    });\n  };\n  server.start();\n```\n\n```c++\n  // client\n  rpc_client client;\n  client.on_open = [\u0026](const std::shared_ptr\u003crpc_core::rpc\u003e\u0026 rpc) {\n    rpc-\u003ecmd(\"cmd\")\n        -\u003emsg(std::string(\"hello\"))\n        -\u003ersp([\u0026](const std::string\u0026 data) {\n        })\n        -\u003ecall();\n  };\n  client.on_close = [\u0026] {\n  };\n  client.open(\"localhost\", 8080);\n```\n\n# Links\n\n* for the platform with Operating System, there is a library based on\n  asio: [asio_net](https://github.com/shuai132/asio_net)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuai132%2Fesp_rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshuai132%2Fesp_rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshuai132%2Fesp_rpc/lists"}