{"id":16156563,"url":"https://github.com/nioc/jeedom-websocket","last_synced_at":"2025-04-07T01:19:52.100Z","repository":{"id":42642023,"uuid":"250903703","full_name":"nioc/jeedom-websocket","owner":"nioc","description":"Jeedom plugin to provide a client-server communication over websocket protocol","archived":false,"fork":false,"pushed_at":"2023-04-19T19:30:59.000Z","size":1977,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-13T06:45:21.219Z","etag":null,"topics":["jeedom","jeedom-plugin","websocket","websocket-server"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nioc.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,"publiccode":null,"codemeta":null}},"created_at":"2020-03-28T22:11:28.000Z","updated_at":"2023-02-23T22:24:07.000Z","dependencies_parsed_at":"2024-11-02T03:41:23.471Z","dependency_job_id":"55d4bc1f-62a7-4fbf-90b9-84bdea7ed050","html_url":"https://github.com/nioc/jeedom-websocket","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fjeedom-websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fjeedom-websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fjeedom-websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nioc%2Fjeedom-websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nioc","download_url":"https://codeload.github.com/nioc/jeedom-websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247574319,"owners_count":20960538,"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":["jeedom","jeedom-plugin","websocket","websocket-server"],"created_at":"2024-10-10T01:45:17.357Z","updated_at":"2025-04-07T01:19:52.084Z","avatar_url":"https://github.com/nioc.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![Screenshot desktop](/logo.png) Jeedom Websocket\n\n[![license: GPLv2](https://img.shields.io/badge/license-GPLv2-blue.svg)](https://www.gnu.org/licenses/gpl-2.0) [![GitHub release](https://img.shields.io/github/release/nioc/jeedom-websocket.svg)](https://github.com/nioc/jeedom-websocket/releases/latest)\n\n[Jeedom](https://www.jeedom.com) plugin to provide a reliable low latency bidirectional client-server communication over [websocket](https://wikipedia.org/wiki/WebSocket) protocol.\n\nEvents are pushed to clients avoiding long polling (Ajax request) overhead.\n\nReduce server load by sharing the Jeedom query and broadcast result to multiples clients.\n\n## Installation \u0026 configuration\n\n-   Install plugin:\n    -   Upload `Websocket.zip` file in the Jeedom plugin admin GUI,\n    -   Set plugin logical id: `Websocket`,\n    -   Save and refresh (F5).\n\n-   Tune plugin configuration (from plugin configuration GUI):\n    -   Websocket internal port: any available port (default `8090`),\n    -   Period in seconds between events readings,\n    -   Period in seconds before closing an unauthenticated connection,\n    -   Allowed hosts (**most important**): comma-separated list of hosts which are allowed to connect to websocket, example: `myjeedom.ltd,10.0.0.42` (default set to your internal and external Jeedom instance hosts).\n\n-   (Optional) proxying websocket port (`8090`) to regular http (`80`) / https (`443`) with Apache (require `proxy_wstunnel` module) by adding the following lines in `/etc/apache2/sites-enabled/000-default.conf`:\n    ```configuration\n      \u003cLocation \"/myawesomesocket\"\u003e\n              ProxyPass ws://localhost:8090\n              ProxyPassReverse ws://localhost:8090\n      \u003c/Location\u003e\n    ```\n\n-   Check [daemon configuration](/resources/jeedom-websocket.service):\n    -   Does webserver user is not `www-data`?\n        -   Change line `User=www-data`\n    -   Does jeedom path is not `/var/www/html/`?\n        -   Change line `WorkingDirectory=/var/www/html/plugins/Websocket/core/php`\n    -   Does PHP path is not `/usr/bin/php`?\n        -   Change line `ExecStart=/usr/bin/php bin/server.php`\n\n## Use\n\nTo get Jeedom events, client:\n\n1.  connect to websocket endpoint,\n2.  send user API key as soon as `onopen` event occurs,\n3.  do your useful stuffs with Jeedom events.\n\nJavaScript example:\n\n```javascript\n//1. connect\nconst websocket = new WebSocket('ws://10.0.0.42/myawesomesocket')\n\n//2. send user credentials\nwebsocket.onopen = (e) =\u003e {\n  const authMsg = JSON.stringify({ apiKey: 'userApiKey' })\n  websocket.send(authMsg)\n}\n\n//3. Handle events\nwebsocket.onmessage = (e) =\u003e {\n  //do stuff with Jeedom events (e.data.result)\n}\nwebsocket.onerror = (e) =\u003e {\n  //handle error\n}\nwebsocket.onclose = (e) =\u003e {\n  //handle connection closed\n}\n```\n\n## Credits\n\n-   **[Nioc](https://github.com/nioc/)** - _Initial work_\n\nSee also the list of [contributors](https://github.com/nioc/jeedom-websocket/contributors) to this project.\n\nThis project is powered by the following components:\n\n-   [Ratchet](https://github.com/ratchetphp/Ratchet) (MIT)\n-   [NextDom plugin-template](https://github.com/NextDom/plugin-template) (GPLv2)\n-   [Jeedom](https://github.com/jeedom) (GPL)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fjeedom-websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnioc%2Fjeedom-websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnioc%2Fjeedom-websocket/lists"}