{"id":21423254,"url":"https://github.com/tsukinoko-kun/gopherpc","last_synced_at":"2026-04-24T11:34:12.217Z","repository":{"id":263208280,"uuid":"889684194","full_name":"tsukinoko-kun/gopherpc","owner":"tsukinoko-kun","description":"GopheRPC is a RPC library that lets you call Go server functions from your JavaScript (browser) clients","archived":false,"fork":false,"pushed_at":"2025-04-04T22:28:03.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T16:44:37.601Z","etag":null,"topics":["golang","javascript","rpc","rpc-framework","rpc-library"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsukinoko-kun.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,"zenodo":null}},"created_at":"2024-11-17T00:14:34.000Z","updated_at":"2025-04-04T22:27:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"4cc7331d-a8ff-4ab4-a6bd-cf0b64837984","html_url":"https://github.com/tsukinoko-kun/gopherpc","commit_stats":null,"previous_names":["tsukinoko-kun/gopherpc"],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/tsukinoko-kun/gopherpc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fgopherpc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fgopherpc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fgopherpc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fgopherpc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsukinoko-kun","download_url":"https://codeload.github.com/tsukinoko-kun/gopherpc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsukinoko-kun%2Fgopherpc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32221577,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["golang","javascript","rpc","rpc-framework","rpc-library"],"created_at":"2024-11-22T21:15:21.651Z","updated_at":"2026-04-24T11:34:12.211Z","avatar_url":"https://github.com/tsukinoko-kun.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GopheRPC\n\nGopheRPC is a RPC library that lets you call Go server functions from your JavaScript (browser) clients without any additional dependencies or code generation.\n\nServer functions can be added on runtime (even after the client has connected to the server) and can return any value or error that is JSON serializable.  \nReturn values on client side are wrapped in a `Promise`.\n\n\u003cimg src=\"gopherpc.svg\" width=\"200\"\u003e\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"net/http\"\n\n\t\"github.com/tsukinoko-kun/gopherpc/v2\"\n)\n\nfunc main() {\n\tgopherpc.Register(\"foo\", func(ctx context.Context, args []any) (any, error) {\n\t\treturn \"bar\", nil\n\t})\n\n\t// Use HandleFunc, Handle or Get depending on the mux you are using.\n\t// Tested with net/http and chi router.\n\tgopherpc.HandleFunc(http.DefaultServeMux)\n\n\thttp.HandleFunc(\"/\", func(w http.ResponseWriter, r *http.Request) {\n\t\tw.Header().Set(\"Content-Type\", \"text/html\")\n\t\tw.Write([]byte(`\u003c!DOCTYPE html\u003e\n\t\t\t\u003chtml\u003e\n\t\t\t\t\u003chead\u003e\n\t\t\t\t\t\u003ctitle\u003eGopherPC\u003c/title\u003e\n\t\t\t\t\u003c/head\u003e\n\t\t\t\t\u003cbody\u003e` +\n\t\t\t\t\tgopherpc.ImportJs() + // script tag that imports the gopherpc.js runtime\n\t\t\t\t\t`\u003cbutton onclick=\"gopherpc.foo().then(alert)\"\u003eCall foo\u003c/button\u003e\n\t\t\t\t\u003c/body\u003e\n\t\t\t\u003c/html\u003e`))\n\t})\n\n\tif err := http.ListenAndServe(\":8080\", nil); err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n\n## Args\n\nUse `gopherpc.Unmarshal` to parse your `[]any` args into a struct.\n\nThe order of the args is the same as the order of the fields in the struct.  \nYou can override this by using the `index` tag.\n\n```go\ntype Args struct {\n\tName   string\n\tEmail  string\n\tLoaded bool   `index:\"-\"`\n\tPhone  string `index:\"2\"`\n}\n```\n\n```go\ngopherpc.Register(\"foo\", func(ctx context.Context, args []any) (any, error) {\n\tvar a Args\n\tif err := gopherpc.Unmarshal(args, \u0026a); err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn a.Name + \" \" + a.Email + \" \" + a.Phone, nil\n})\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukinoko-kun%2Fgopherpc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsukinoko-kun%2Fgopherpc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsukinoko-kun%2Fgopherpc/lists"}