{"id":18581895,"url":"https://github.com/coder/wsep","last_synced_at":"2025-04-10T11:35:37.235Z","repository":{"id":40659836,"uuid":"265424777","full_name":"coder/wsep","owner":"coder","description":"High performance command execution protocol","archived":false,"fork":false,"pushed_at":"2023-01-10T20:56:15.000Z","size":119,"stargazers_count":28,"open_issues_count":1,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-04-02T22:35:31.111Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/coder.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-20T02:18:00.000Z","updated_at":"2025-03-03T05:28:39.000Z","dependencies_parsed_at":"2023-02-08T20:15:16.624Z","dependency_job_id":null,"html_url":"https://github.com/coder/wsep","commit_stats":null,"previous_names":["cdr/wsep"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fwsep","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fwsep/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fwsep/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder%2Fwsep/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coder","download_url":"https://codeload.github.com/coder/wsep/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208688,"owners_count":21065205,"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":[],"created_at":"2024-11-07T00:08:10.042Z","updated_at":"2025-04-10T11:35:32.215Z","avatar_url":"https://github.com/coder.png","language":"Go","readme":"# wsep\n\n`wsep` is a high performance command execution protocol over WebSocket. It can be thought of as SSH over WebSockets without encryption.\n\nThe package offers the `wsep.Execer` interface so that local, SSH, and WebSocket execution can be interchanged. This is particular useful when testing.\n\n## Examples\n\nError handling is omitted for brevity.\n\n### Client\n\n```golang\nconn, _, _ := websocket.Dial(ctx, \"ws://remote.exec.addr\", nil)\ndefer conn.Close(websocket.StatusNormalClosure, \"normal closure\")\n\nexecer := wsep.RemoteExecer(conn)\nprocess, _ := execer.Start(ctx, wsep.Command{\n  Command: \"cat\",\n  Args:    []string{\"go.mod\"},\n  Stdin:   false,\n})\n\ngo io.Copy(os.Stderr, process.Stderr())\ngo io.Copy(os.Stdout, process.Stdout())\n\nprocess.Wait()\n```\n\n### Server\n\n```golang\nfunc (s server) ServeHTTP(w http.ResponseWriter, r *http.Request) {\n  conn, _ := websocket.Accept(w, r, nil)\n  defer conn.Close(websocket.StatusNormalClosure, \"normal closure\")\n\n  wsep.Serve(r.Context(), conn, wsep.LocalExecer{})\n}\n```\n\n### Development / Testing\n\nStart a local executor:\n\n```sh\ngo run ./dev/server\n```\n\nStart a client:\n\n```sh\ngo run ./dev/client tty --id 1 -- bash\ngo run ./dev/client notty -- ls -la\n```\n\n### Benchmarks\n\nLocal `sh` through a local `wsep` connection\n\n```shell script\n$ head -c 100000000 /dev/urandom \u003e /tmp/random; cat /tmp/random | pv | time ./bin/client notty -- sh -c \"cat \u003e /dev/null\"\n\n95.4MiB 0:00:00 [ 269MiB/s] [ \u003c=\u003e                                                                                  ]\n./bin/client notty -- sh -c \"cat \u003e /dev/null\"  0.32s user 0.31s system 31% cpu 2.019 total\n```\n\nLocal `sh` directly\n\n```shell script\n$ head -c 100000000 /dev/urandom \u003e /tmp/random; cat /tmp/random | pv | time  sh -c \"cat \u003e /dev/null\"\n\n95.4MiB 0:00:00 [1.73GiB/s] [ \u003c=\u003e                                                                                  ]\nsh -c \"cat \u003e /dev/null\"  0.00s user 0.02s system 32% cpu 0.057 total\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder%2Fwsep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder%2Fwsep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder%2Fwsep/lists"}