{"id":36813481,"url":"https://github.com/rocket049/go-jsonrpc2glib","last_synced_at":"2026-01-12T13:51:23.849Z","repository":{"id":57563782,"uuid":"161730236","full_name":"rocket049/go-jsonrpc2glib","owner":"rocket049","description":"help `github.com/powerman/rpc-codec/jsonrpc2` create server compatibly jsonrpc-glib-1.0","archived":false,"fork":false,"pushed_at":"2019-06-17T03:23:48.000Z","size":22,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-06-20T08:18:40.867Z","etag":null,"topics":["go","jsonrpc-glib","rpc"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rocket049.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-14T04:10:21.000Z","updated_at":"2021-03-18T02:45:37.000Z","dependencies_parsed_at":"2022-08-31T13:42:14.923Z","dependency_job_id":null,"html_url":"https://github.com/rocket049/go-jsonrpc2glib","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/rocket049/go-jsonrpc2glib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocket049%2Fgo-jsonrpc2glib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocket049%2Fgo-jsonrpc2glib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocket049%2Fgo-jsonrpc2glib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocket049%2Fgo-jsonrpc2glib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rocket049","download_url":"https://codeload.github.com/rocket049/go-jsonrpc2glib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rocket049%2Fgo-jsonrpc2glib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28339623,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["go","jsonrpc-glib","rpc"],"created_at":"2026-01-12T13:51:23.149Z","updated_at":"2026-01-12T13:51:23.836Z","avatar_url":"https://github.com/rocket049.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-jsonrpc2glib\nHelp developer create server compatibly `jsonrpc-glib-1.0` .\n\nUse `github.com/powerman/rpc-codec/jsonrpc2` inside.\n\n帮助程序员开发兼容`jsonrpc-glib-1.0`的`jsonrpc2`服务器。\n\n### Install\n`go get github.com/rocket049/go-jsonrpc2glib`\n\n### Example:\n```\n//server.go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"net\"\n\t\"net/rpc\"\n\t\"os\"\n\t\"os/signal\"\n\t\"strings\"\n\n\t\"github.com/rocket049/go-jsonrpc2glib\"\n)\n\ntype Arith int\n\ntype ParamsT struct {\n\tArg string\n}\n\nfunc (t *Arith) Hello(args []string, reply *string) error {\n\t*reply = strings.Join(args, \"\\n\")\n\treturn nil\n}\n\nfunc main() {\n\tarith := new(Arith)\n\trpc.Register(arith)\n\tl, e := net.Listen(\"tcp\", \"127.0.0.1:6666\")\n\tdefer l.Close()\n\tif e != nil {\n\t\tlog.Fatal(\"listen error:\", e)\n\t}\n\tfor {\n\t\tconn, err := l.Accept()\n\t\tif err != nil {\n\t\t\tlog.Println(err)\n\t\t}\n\t\tgo jsonrpc2glib.ServeGlib(conn, nil)\n\t}\n\n\twaitSig()\n}\n\nfunc waitSig() {\n\tvar c chan os.Signal = make(chan os.Signal, 1)\n\tsignal.Notify(c, os.Interrupt, os.Kill)\n\ts := \u003c-c\n\tfmt.Println(\"\\nSignal:\", s)\n}\n\n//client.vala\n//valac --pkg jsonrpc-glib-1.0 jsonclient.vala\nusing Jsonrpc;\n\nowned SocketConnection rpcConnect(string host,uint16 port){\n\tResolver resolver = Resolver.get_default ();\n\tList\u003cInetAddress\u003e addresses = resolver.lookup_by_name (host, null);\n\tInetAddress address = addresses.nth_data (0);\n\tSocketClient client = new SocketClient ();\n\tSocketConnection conn = client.connect(new InetSocketAddress (address, port));\n\treturn conn;\n}\n\nvoid rpcClient(SocketConnection conn){\n\tvar c = new Jsonrpc.Client(conn);\n\tstring[] v = {\"Hello friend.\",\"无限恐怖\",\"abcde\"};\n\tvar params = new Variant.strv(v);\n\tVariant res;\n\ttry{\n\t\tfor (int i=0;i\u003c5;i++){\n\t\t\tvar ok = c.call(\"Arith.Hello\",params,null,out res);\n\t\t\tif(ok){\n\t\t\t\tstdout.printf(\"%s\\n\",res.get_string());\n\t\t\t}else{\n\t\t\t\tstdout.printf(\"error\\n\");\n\t\t\t}\n\t\t}\n\t}catch (Error e) {\n\t\tstdout.printf (\"Error: %s\\n\", e.message);\n\t}\n\tconn.close();\n}\n\nvoid main(){\n\tvar conn = rpcConnect(\"localhost\",6666);\n\trpcClient(conn);\n\tstdout.printf(\"end\\n\");\n}\n```\n*end*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocket049%2Fgo-jsonrpc2glib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frocket049%2Fgo-jsonrpc2glib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frocket049%2Fgo-jsonrpc2glib/lists"}