{"id":19142340,"url":"https://github.com/eldoy/kabel","last_synced_at":"2025-07-28T19:07:58.100Z","repository":{"id":57288010,"uuid":"298608401","full_name":"eldoy/kabel","owner":"eldoy","description":"Server that relays messages to websocket clients (i.e. browsers)","archived":false,"fork":false,"pushed_at":"2020-09-26T08:48:35.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-09T13:52:29.274Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/eldoy.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":"2020-09-25T15:16:35.000Z","updated_at":"2022-06-04T21:52:55.000Z","dependencies_parsed_at":"2022-09-19T17:24:39.293Z","dependency_job_id":null,"html_url":"https://github.com/eldoy/kabel","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/eldoy/kabel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fkabel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fkabel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fkabel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fkabel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eldoy","download_url":"https://codeload.github.com/eldoy/kabel/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eldoy%2Fkabel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267569369,"owners_count":24109056,"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","status":"online","status_checked_at":"2025-07-28T02:00:09.689Z","response_time":68,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-09T07:26:53.842Z","updated_at":"2025-07-28T19:07:57.778Z","avatar_url":"https://github.com/eldoy.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Kabel\nServer that relays messages to websocket clients (i.e. browsers). Useful for sending commands to applications via the command line, for example tell the browser to reload when a file changes.\n\n### Installation\n`npm i -g kabel`\n\n### Setup autoreload for your web app\n\n#### Start kabel\n```bash\n# Default port is 3900\nkabel\n\n# With different port as option\nkabel -p 3010\n\n# or with env variable\nKABEL_PORT=3011 kabel\n\n# You can also set the wait in ms before sending the message\nkabel -w 500\n\n# or with env variable\nKABEL_WAIT=500 kabel\n\n# Quiet output\nkabel -q\n\n# or with env variable\nKABEL_QUIET=0\n```\nYou only need one kabel server for all your apps.\n\n#### Set up web socket connection\nInclude this on in your web app:\n```html\n\u003cscript\u003e\n  var ws = new WebSocket('ws://localhost:3900')\n  ws.onopen = function() {\n    // Change the name to the name of your app\n    // The name should match what you're sending with curl\n    ws.send(JSON.stringify({ name: 'app' }))\n  }\n  ws.onmessage = function() {\n    window.location.reload(true)\n  }\n  ws.onerror = function() {\n    console.log('Error connecting to kabel')\n  }\n\u003c/script\u003e\n```\n\n#### Automatic reload with nodemon\nCreate a `nodemon.json` file in your app root direcory that looks like this:\nkabel.js notify 'http://localhost:3900?name=cfhqadmin'\n```json\n{\n  \"events\": {\n    \"restart\": \"kabel notify 'http://localhost:3900?name=app'\"\n   }\n}\n```\nYour application will now reload every time nodemon restarts.\n\nAlternatively you can use `curl`:\n```json\n{\n  \"events\": {\n    \"restart\": \"curl -X POST -d 'name=app' http://localhost:3900\"\n   }\n}\n```\n\n#### Send a message to the browser via kabel\n```\n# From terminal using kabel\nkabel notify 'http://localhost:3900?name=app'\n\n# From terminal using curl\ncurl -X POST -d 'name=app' http://localhost:3900\n```\nYour app should now have reloaded.\n\n### License\nMIT licensed. Enjoy!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fkabel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feldoy%2Fkabel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feldoy%2Fkabel/lists"}