{"id":13528210,"url":"https://github.com/eliihen/wsta","last_synced_at":"2025-04-01T11:31:07.070Z","repository":{"id":77988109,"uuid":"57909325","full_name":"eliihen/wsta","owner":"eliihen","description":"A CLI development tool for WebSocket APIs","archived":false,"fork":false,"pushed_at":"2018-11-06T07:18:04.000Z","size":197,"stargazers_count":630,"open_issues_count":11,"forks_count":19,"subscribers_count":12,"default_branch":"master","last_synced_at":"2024-08-20T21:16:49.560Z","etag":null,"topics":["cli","developer-tools","rust","websocket"],"latest_commit_sha":null,"homepage":"","language":"Rust","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/eliihen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-05-02T17:55:28.000Z","updated_at":"2024-08-13T03:03:41.000Z","dependencies_parsed_at":"2023-03-02T11:16:04.973Z","dependency_job_id":null,"html_url":"https://github.com/eliihen/wsta","commit_stats":null,"previous_names":["eliihen/wsta","esphen/wsta"],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fwsta","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fwsta/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fwsta/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eliihen%2Fwsta/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eliihen","download_url":"https://codeload.github.com/eliihen/wsta/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246631760,"owners_count":20808748,"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":["cli","developer-tools","rust","websocket"],"created_at":"2024-08-01T06:02:19.016Z","updated_at":"2025-04-01T11:31:06.777Z","avatar_url":"https://github.com/eliihen.png","language":"Rust","funding_links":[],"categories":["Rust"],"sub_categories":[],"readme":"# wsta\n\nThe WebSocket Transfer Agent\n\n[![Build Status](https://travis-ci.org/esphen/wsta.svg?branch=master)](https://travis-ci.org/esphen/wsta)\n[![Build status](https://ci.appveyor.com/api/projects/status/m3c9r5uw883b9l3y?svg=true)](https://ci.appveyor.com/project/esphen/wsta)\n\n`wsta` is a cli tool written in rust for interfacing with WebSockets. `wsta` has\nthe philosophy of being an easy tool to learn and thus gets out of your way to\nlet you work your UNIX magic directly on the WebSocket traffic.\nThe way `wsta` does this is to be as pipe-friendly as possible, letting you\nchain it into complex pipelines or bash scripts as you see fit, or just keep it\nsimple and use it as is.\n\nSee the [manual](wsta.md) or type `man wsta` for details.\n\n## Cool things you can do\n\nSince `wsta` is really pipe-friendly, you can easily work with your output in\na way that suits you. If you have a websocket-service that returns JSON, you\nmight want to have your data printed in a nice, readable format.\n[jq](https://stedolan.github.io/jq/) is perfect for that.\n\n```bash\n$ wsta ws://echo.websocket.org '{\"values\":{\"test\": \"what?\"}}' | jq .values\nConnected to ws://echo.websocket.org\n{\n  \"test\": \"what?\"\n}\n```\n\nBecause `wsta` reads from stdin, it can also be used as an interactive prompt\nif you wish to send messages to the server interactively.\n\n```bash\n$ wsta ws://echo.websocket.org\nConnected to ws://echo.websocket.org\nping\nping\nhello\nhello\n```\n\nIf you're debugging some nasty problem with your stream, you are probably only\ninterested in frames related to your problem. Good news, `grep` is here to save\nthe day!\n\n```bash\n$ while true; do echo  $(( RANDOM %= 200 )); sleep 0.2; done | wsta ws://echo.websocket.org | grep '147'\n147\n147\n147\n147\n147\n147\n```\n\nUse `wsta` to monitor your websocket uptime. Use the `--ping` option to keep\nthe connection alive, and check the exit code for issues. You can also send\nthe last few messages with POST data for a higher quality alert.\n\n```bash\nwhile true; do\n\n  # Start persistent connection, pinging evey 10 seconds to stay alive\n  wsta -v --ping 10 ws://echo.websocket.org \u003e messages.txt\n\n  if [ $? -gt 0 ]; then\n    tail messages.txt | curl -F \"messages=@-\" https://SOUNDTHEALARM.yourcompany.com\n  fi\n\n  sleep 30\ndone\n```\n\nIf you need to load test your server over a WebSocket connection, it is simple\nto write a short bash script to do this. The following example uses a loop to\ncontinously send messages to the server and saturate the connection as much as\npossible. This example could also be ran in parallel as many times as required\nto add more saturated connections to the load test.\n\n```bash\nfor i in {1..1000}\ndo\n  echo \"subscribe?giveMeLotsOfData=true\u0026id=$i\"\n  echo \"unsubscribe?id=$i\"\ndone | wsta ws://echo.websocket.org\n```\n\n`wsta` also supports binary data using the `--binary` argument. When provided,\nall data read from stdin is assumed to be in binary format. The following\nsimplified example records a binary stream from the microphone and sends it\ncontinously to the server, reading the response JSON as it comes in.\n\nFor more information on binary mode, see\n[the manual](https://github.com/esphen/wsta/blob/master/wsta.md) and\n[#5](https://github.com/esphen/wsta/issues/5).\n\n```bash\n$ arecord --format=S16_LE --rate=44100 | wsta -b 'wss://example.com' | jq .results\n\"hello \"\n\"hello this is me \"\n\"hello this is me talking to \"\n\"hello this is me talking to people \"\n\"hello this is me talking to people \"\n```\n\n## Configuration profiles\n\nA neat feature of `wsta` is the ability to have several separate configuration\nprofiles. Configuration profiles are basically presets of CLI arguments like\nurls and headers saved to a file for easy reuse at a later point.\n\nIf you have web services in different environments, you might for example want\nto have a `foo-dev` and `foo-prod` configuration file. This makes it easy to at\na later date connect to `foo` by simply running `wsta -P foo-dev`,\n\nThese files could be checked into VCS and shared between colleagues.\n\nAn example of a configuration file:\n\n```C\nurl = \"ws://echo.websocket.org\";\nheaders = [\"Origin:google.com\", \"Foo:Bar\"];\nshow_headers = true;\n```\n\nSee [the manual](https://github.com/esphen/wsta/blob/master/wsta.md) for more\ninformation.\n\n## Installation\n\n### Requirements\n\nCurrently the only requirement to run `wsta` is rust-openssl. If you get an error\nabout a missing `ssllib.so` or similar, try installing OpenSSL runtime libraries\nand headers. Have a look at [this link](https://github.com/sfackler/rust-openssl#building)\nfor instructions on how to do so.\n\n### 64-bit Linux\nI've set up a download page here that you can get `wsta`\n\nhttps://software.opensuse.org/download.html?project=home%3Aesphen\u0026package=wsta\n\nI'm working on getting more distributions, as well as 32-bit into the Open Build\nService pipeline, which is what creates the releases on that page. For now, you\nneed a 64-bit system to use that page. If you don't use a 64-bit system, have a\nlook below at binaries or compiling it yourself.\n\n### Gentoo Linux\n`wsta` can be found in the Gentoo portage tree as `dev-util/wsta`. In order to\ninstall it, simply run the following command.\n\n    emerge dev-util/wsta\n\n### Mac OS X\nTo install on Max OS X, ensure you have [homebrew](http://brew.sh) installed,\nthen run the following commands. It's going to take a while, please be patient.\n\n    brew tap esphen/wsta https://github.com/esphen/wsta.git\n    brew install wsta\n\nYou can also find binary releases on the\n[releases page](https://github.com/esphen/wsta/releases).\n\n### Other Linux distributions\nI only provide so many Linux distros on OBS, and only 64-bit versions. If your\ncomputer does not fit into the distros provided, then have a look at the\ndownload section of the most recent release, and place the attached binary into\nyour `$PATH`.\n\nhttps://github.com/esphen/wsta/releases\n\n### Windows\n\nWindows binaries are compiled for each release. Ensure you have a command\nprompt with GNU libraries, for example the `git` prompt, and run the provided\nbinary file from there.\n\nYou can find binary releases on the\n[releases page](https://github.com/esphen/wsta/releases).\n\n### Compile it yourself\n\nDON'T PANIC. It's really easy to compile and install `wsta` yourself! Rust\nprovides solid tools like `cargo` for automating the compilation. If you compile\n`wsta` yourself, it should run on all of\n[rust's supported platforms](https://doc.rust-lang.org/book/getting-started.html#platform-support).\n\n    # Install the rust language and tools\n    curl https://sh.rustup.rs -sSf | sh\n\n    # Install gcc and OpenSSL on your OS\n    dnf install -y gcc openssl-devel\n\n    # Install wsta to `$HOME/.cargo` or `$CARGO_HOME` if set.\n    # To change the install path, try setting --root to a directory like /usr/local\n    cargo install --git https://github.com/esphen/wsta.git\n\n## Development setup\n\n[Install the rust language and\ntools](https://doc.rust-lang.org/book/getting-started.html#installing-rust).\n\n    curl https://sh.rustup.rs -sSf | sh\n\nRun the program\n\n    cargo run -- -vvv -I -e ws://echo.websocket.org\n\nIn order to generate the man page, `groff` is needed\n\n    make man\n\nIf updates to the man page are done, remember to generate the markdown manual\nafterwards\n\n    make wsta.md\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliihen%2Fwsta","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feliihen%2Fwsta","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feliihen%2Fwsta/lists"}