{"id":26085218,"url":"https://github.com/semrush/ws2http","last_synced_at":"2025-04-12T02:01:15.200Z","repository":{"id":57603779,"uuid":"68826041","full_name":"semrush/ws2http","owner":"semrush","description":"JSON-RPC 2.0 Websocket to HTTP backend proxy service.","archived":false,"fork":false,"pushed_at":"2017-09-11T12:23:05.000Z","size":32,"stargazers_count":6,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T21:47:11.744Z","etag":null,"topics":["json-rpc2","websocket-proxy"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semrush.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}},"created_at":"2016-09-21T14:36:40.000Z","updated_at":"2023-09-14T15:39:20.000Z","dependencies_parsed_at":"2022-09-26T20:00:53.918Z","dependency_job_id":null,"html_url":"https://github.com/semrush/ws2http","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/semrush%2Fws2http","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semrush%2Fws2http/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semrush%2Fws2http/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semrush%2Fws2http/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semrush","download_url":"https://codeload.github.com/semrush/ws2http/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248505862,"owners_count":21115354,"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":["json-rpc2","websocket-proxy"],"created_at":"2025-03-09T05:55:00.523Z","updated_at":"2025-04-12T02:01:15.071Z","avatar_url":"https://github.com/semrush.png","language":"Go","readme":"ws2http \n======\n\nJSON-RPC 2.0 WebSocket to HTTP proxy.\n\nRequirements\n------\n  \n  * Golang 1.5+ \n\nUsage\n------\n\n    Usage of ./ws2http:\n      -c int\n            max parallel http requests per host (default 10)\n      -h string\n            websocket listen address (default \"localhost:8090\")\n      -headers string\n            allow set custom http headers to rpc backend via comma (default \"Authorization\")\n      -route value\n            mapping from websocket endpoint to http endpoint, like /rpc:http://localhost/rpc (default [])\n      -timeout int\n            timeout in seconds for http requests (default 20)\n      -trace\n            enable trace output\n      -verbose\n            enable debug output\n\n\n\nFeatures\n------\n \n * Proxies all data from WS to HTTP endpoint\n * Timeout for http requests (default 20)\n * Concurrent http requests to host by session (default 10)\n * Trace logs (requests/responses)\n * Encapsulated http backend errors to JSON-RPC errors (returns -1 * httpStatusCode as error code)\n * Supports multiple endpoints\n * Supports /metrics endpoint as Prometheus handler\n * Supports /debug/conns endpoint as remote connection tracer\n \n### Goals\n\n * [x] shared ws endpoint with internal routing with prefix for methods\n * [ ] better interface for /debug/conns\n * [ ] support batch requests for metrics and routing\n * [ ] rewrite HttpForwarder.Handler into smaller parts\n * [ ] expand batch requests\n\n\nHow to run\n------\n    go get github.com/semrush/ws2http\n    $GOPATH/bin/ws2http -verbose -route /rpc:http://localhost/rpc/\n   \n### Examples\n    \n    var w = new WebSocket(\"ws://localhost/rpc\"); w.onmessage = function(data) { console.log(data); };\n    w.send('SET Authorization authValue')\n    w.send('{\"jsonrpc\":\"2.0\",\"method\":\"Ping\",\"id\":\"1\"}')\n    ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemrush%2Fws2http","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemrush%2Fws2http","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemrush%2Fws2http/lists"}