{"id":49094322,"url":"https://github.com/asumbek/wshocket","last_synced_at":"2026-04-20T19:35:34.305Z","repository":{"id":134730179,"uuid":"600439215","full_name":"asumbek/wshocket","owner":"asumbek","description":"A Bash library to interact with the websockets.","archived":false,"fork":false,"pushed_at":"2024-01-12T11:46:53.000Z","size":29,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-31T22:24:13.718Z","etag":null,"topics":["bash","bash-library","shell","websocat","websocket"],"latest_commit_sha":null,"homepage":"","language":"Shell","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/asumbek.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}},"created_at":"2023-02-11T13:56:14.000Z","updated_at":"2024-08-09T12:43:19.000Z","dependencies_parsed_at":"2023-12-06T11:14:39.493Z","dependency_job_id":"d5db0ab6-cf3c-4f3a-a06e-f2d6b8bfde9b","html_url":"https://github.com/asumbek/wshocket","commit_stats":null,"previous_names":["komodcat/shocket","komothecat/shocket","komothecat/wshocket","cattokomo/wshocket","mbekkomo/wshocket","0komo/wshocket","fuzzko/wshocket","asumbek/wshocket"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/asumbek/wshocket","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asumbek%2Fwshocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asumbek%2Fwshocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asumbek%2Fwshocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asumbek%2Fwshocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asumbek","download_url":"https://codeload.github.com/asumbek/wshocket/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asumbek%2Fwshocket/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32062800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"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":["bash","bash-library","shell","websocat","websocket"],"created_at":"2026-04-20T19:35:32.266Z","updated_at":"2026-04-20T19:35:34.298Z","avatar_url":"https://github.com/asumbek.png","language":"Shell","readme":"\u003cdiv align=\"center\"\u003e\n\nShocket\n---\nA Bash library for easier interacting with WebSocket\u003cbr\u003e\n[![Latest Release](https://img.shields.io/github/v/release/komothecat/wshocket?style=for-the-badge)](https://github.com/komothecat/wshocket/releases/latest)\n\n\u003c/div\u003e\n\nThis library helps you with interacting WebSocket through Bash scripting language, it adds features for creating, connecting, sending and receiving text from WebSocket server!\n\n**Table of Contents**\n * [Installation](#Installation)\n * [Usage](#Usage)\n * [API](#API)\n    * [wshocket_new](#wshocket_new)\n    * [wshocket_connect](#wshocket_connect)\n    * [wshocket_send](#wshocket_send)\n    * [wshocket_receive](#wshocket_receive)\n    * [wshocket_close](#wshocket_close)\n\n## Installation\nShocket dependencies:\n * `websocat` from [Websocat](https://github.com/vi/websocat).\n * `nc` from [OpenBSD variant](https://man.openbsd.org/nc.1) of netcat, [GNU variant](https://netcat.sourceforge.net/) might also works.\n\nYou can install Shocket via `bpkg`:\n```bash\nbpkg install komothecat/wshocket\n```\nor copy-and-paste it:\n```bash\ngit clone https://github.com/komothecat/wshocket\ncp wshocket/wshocket.sh .\n```\n\n## Usage\nShocket does not use async event or anything, just `wshocket_new`, `wshocket_connect` and `wshocket_close`\n```bash\n. wshocket.sh # or `source wshocket.sh`\n\nwshocket_new my_ws wss://ws.ifelse.io # create `my_ws` variable with uri\n\necho \"inside my_ws\"\ndeclare -p my_ws\n\nif wshocket_connect my_ws conn_err; then # connect to the websocket echo server\n    wshocket_receive my_ws \u003e/dev/null # suppress message from server\n\n    wshocket_send my_ws 'Hello from Shocket'\n    wshocket_receive my_ws #=\u003e Hello from Shocket\nelse echo \"$conn_err\"; exit 1; fi\n\nwshocket_close my_ws\n```\n\n## API\n\n\u003e For tracking error, append `wshocket_*` function argument, e.g `wshocket_connect ws err`. This will create a variable named `err` in your environment.\n\n### wshocket_new\nUsage: `wshocket_new \u003cvariable-name\u003e \u003curi\u003e`\n\nCreate an associative array with name based on param `variable-name` with URI `uri`\n```bash\n# Creates `ws_var` variable\nwshocket_new ws_var wss://ws.example.com\n\ndeclare -p ws_var\n```\n\n### wshocket_connect\nUsage: `wshocket_connect \u003cvariable\u003e`\n\nStart listening to the WebSocket server\n```bash\nwshocket_new ws_var wss://ws.example.com\n\nwshocket_connect ws_var # Connecting and listening to `ws.example.com`\n```\n\n### wshocket_send\nUsage: `wshocket_send \u003cvariable\u003e \u003cmsg\u003e`\n\nSend a message to WebSocket server\n```bash\nwshocket_connect ws_var\n\nwshocket_send ws_var \"Hello!\" # Send \"Hello!\" to server\n```\n\n### wshocket_receive\nUsage: `wshocket_receive \u003cvariable\u003e`\n\nReceive message from WebSocket server and sent it to STDOUT\n```bash\nwshocket_connect ws_var\n\nwshocket_send ws_var \"Hello!\"\n\nwshocket_receive ws_var # Sent \"Hello!\" to STDOUT\n# or\nMSG=\"$(wshocket_receive ws_var)\" # Sent \"Hello!\" to $MSG\n```\n\n### wshocket_close\nUsage: `wshocket_close \u003cvariable\u003e`\n\nClose connection between client and server.\n```bash\nwshocket_connect ws_var\n\nwshocket_send ws_var \"Hello!\"\nwshocket_receive ws_var\n\nwshocket_close ws_var\n# Closes connection between client and server.\n# Variable that is created with `wshocket_new` will still remain,\n# use `unset` to clear it\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasumbek%2Fwshocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasumbek%2Fwshocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasumbek%2Fwshocket/lists"}