{"id":19848173,"url":"https://github.com/mys1024/m-rpc","last_synced_at":"2025-02-28T20:29:30.857Z","repository":{"id":228620778,"uuid":"771425547","full_name":"mys1024/m-rpc","owner":"mys1024","description":"A message based rpc library.","archived":false,"fork":false,"pushed_at":"2024-05-05T17:17:53.000Z","size":127,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-23T04:07:05.727Z","etag":null,"topics":["javascript","jsr","message","npm","package","rpc"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/mys1024.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}},"created_at":"2024-03-13T09:24:33.000Z","updated_at":"2024-10-11T08:03:12.000Z","dependencies_parsed_at":"2024-04-12T16:39:22.183Z","dependency_job_id":"a74b6e7e-f7b0-4736-b0e6-746d2c999273","html_url":"https://github.com/mys1024/m-rpc","commit_stats":null,"previous_names":["mys1024/m-rpc"],"tags_count":14,"template":false,"template_full_name":"mys1024/starter-deno","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fm-rpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fm-rpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fm-rpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mys1024%2Fm-rpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mys1024","download_url":"https://codeload.github.com/mys1024/m-rpc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241226812,"owners_count":19930487,"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":["javascript","jsr","message","npm","package","rpc"],"created_at":"2024-11-12T13:16:24.862Z","updated_at":"2025-02-28T20:29:30.830Z","avatar_url":"https://github.com/mys1024.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\n# m-rpc\n\n[![jsr-version](https://img.shields.io/jsr/v/%40mys/m-rpc?style=flat-square\u0026color=%23f7df1e)](https://jsr.io/@mys/m-rpc)\n[![npm-version](https://img.shields.io/npm/v/%40mys-x%2Fm-rpc?style=flat-square\u0026color=%23cb3837)](https://www.npmjs.com/package/@mys-x/m-rpc)\n[![npm-minzip](https://img.shields.io/bundlephobia/minzip/%40mys-x%2Fm-rpc?style=flat-square\u0026label=minzip)](https://bundlephobia.com/package/@mys-x/m-rpc)\n[![docs](https://img.shields.io/badge/docs-reference-blue?style=flat-square)](https://jsr.io/@mys/m-rpc/doc?style=flat-square)\n[![stars](https://img.shields.io/github/stars/mys1024/m-rpc?style=flat-square)](https://github.com/mys1024/m-rpc)\n[![license](https://img.shields.io/github/license/mys1024/m-rpc?\u0026style=flat-square)](./LICENSE)\n\n[![coverage](https://img.shields.io/codecov/c/github/mys1024/m-rpc?style=flat-square)](https://app.codecov.io/gh/mys1024/m-rpc)\n[![workflow-ci](https://img.shields.io/github/actions/workflow/status/mys1024/m-rpc/ci.yml?label=ci\u0026style=flat-square)](https://github.com/mys1024/m-rpc/actions/workflows/ci.yml)\n[![workflow-release](https://img.shields.io/github/actions/workflow/status/mys1024/m-rpc/release.yml?label=release\u0026style=flat-square)](https://github.com/mys1024/m-rpc/actions/workflows/release.yml)\n\n_A message based RPC library._\n\n\u003c/div\u003e\n\n## Usage\n\n### basic\n\n```typescript\nimport { MRpc } from \"@mys-x/m-rpc\"; // or \"jsr:@mys/m-rpc\"\n\nfunction add(a: number, b: number) {\n  return a + b;\n}\n\n// The port can be a MessagePort, a WebSocket, a Worker, or a WorkerGlobalScope\nconst { port1, port2 } = new MessageChannel();\nconst rpc1 = new MRpc(port1);\nconst rpc2 = new MRpc(port2);\n\nrpc1.defineLocalFn(\"add\", add);\nawait rpc2.callRemoteFn\u003ctypeof add\u003e(\"add\", [1, 2]); // 3\n```\n\n## License\n\n[MIT](./LICENSE) License \u0026copy; 2024-PRESENT\n[mys1024](https://github.com/mys1024)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmys1024%2Fm-rpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmys1024%2Fm-rpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmys1024%2Fm-rpc/lists"}