{"id":25412269,"url":"https://github.com/samurai016/concrete_websocket","last_synced_at":"2025-04-14T16:45:45.232Z","repository":{"id":130778274,"uuid":"449079627","full_name":"Samurai016/concrete_websocket","owner":"Samurai016","description":"🌐🧱 Unleash the Power: WebSocket Support for Concrete CMS 🚀","archived":false,"fork":false,"pushed_at":"2024-03-23T17:48:28.000Z","size":2477,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-16T11:18:46.993Z","etag":null,"topics":["concrete5","concrete5-addon","concretecms","php","ratchet-php-server","real-time","websocket","websockets"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/Samurai016.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":"2022-01-17T23:33:28.000Z","updated_at":"2023-07-12T19:17:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"edd78bd5-2f87-4df9-ae4d-655e8dc9305a","html_url":"https://github.com/Samurai016/concrete_websocket","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fconcrete_websocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fconcrete_websocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fconcrete_websocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Samurai016%2Fconcrete_websocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Samurai016","download_url":"https://codeload.github.com/Samurai016/concrete_websocket/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248918714,"owners_count":21183241,"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":["concrete5","concrete5-addon","concretecms","php","ratchet-php-server","real-time","websocket","websockets"],"created_at":"2025-02-16T11:18:33.625Z","updated_at":"2025-04-14T16:45:45.198Z","avatar_url":"https://github.com/Samurai016.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🌐🧱 Concrete WebSocket 🚀\n![Last release](https://img.shields.io/github/v/release/Samurai016/concrete_websocket?style=flat-square)\n![License](https://img.shields.io/github/license/Samurai016/concrete_websocket?style=flat-square)\n![Concrete CMS 8](https://img.shields.io/badge/Concrete%20CMS%208-c?style=flat-square\u0026labelColor=%23017ddd\u0026color=017ddd\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNSAyOSI+PGcgZGF0YS1uYW1lPSJMaXZlbGxvIDIiPjxwYXRoIGQ9Ik0xNyAyOGExMSAxMSAwIDAgMS0zIDEgMTIgMTIgMCAwIDEtOS0zYy0zLTItMy01LTEtOCAyLTIgNS0zIDgtMyAyIDAgOCAwIDYgMy0xIDMtNSAwLTggMS0yIDEtMyA0IDAgNmE2IDYgMCAwIDAgNi0xYzItMSA2LTggOS01IDEgMS02IDgtOCA5TTAgMTBsMS0zIDIgMyAxIDctNC03bTYtN2MxLTIgMiAwIDIgMnMzIDkgMSA5LTMtNy0zLThWM204LTMgMSA0YzAgMSAwIDEwLTEgOUwxMiAzYzAtMiAwLTMgMi0zbTQgNiAxLTNjMi0xIDIgMiAyIDNzLTEgOS0zIDljLTItMSAwLTggMC05IiBkYXRhLW5hbWU9IkxpdmVsbG8gMSIgc3R5bGU9ImZpbGw6I2ZmZjtmaWxsLXJ1bGU6ZXZlbm9kZCIvPjwvZz48L3N2Zz4=)\n![Concrete CMS 9](https://img.shields.io/badge/Concrete%20CMS%209-c?style=flat-square\u0026labelColor=%23017ddd\u0026color=017ddd\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNSAyOSI+PGcgZGF0YS1uYW1lPSJMaXZlbGxvIDIiPjxwYXRoIGQ9Ik0xNyAyOGExMSAxMSAwIDAgMS0zIDEgMTIgMTIgMCAwIDEtOS0zYy0zLTItMy01LTEtOCAyLTIgNS0zIDgtMyAyIDAgOCAwIDYgMy0xIDMtNSAwLTggMS0yIDEtMyA0IDAgNmE2IDYgMCAwIDAgNi0xYzItMSA2LTggOS01IDEgMS02IDgtOCA5TTAgMTBsMS0zIDIgMyAxIDctNC03bTYtN2MxLTIgMiAwIDIgMnMzIDkgMSA5LTMtNy0zLThWM204LTMgMSA0YzAgMSAwIDEwLTEgOUwxMiAzYzAtMiAwLTMgMi0zbTQgNiAxLTNjMi0xIDIgMiAyIDNzLTEgOS0zIDljLTItMSAwLTggMC05IiBkYXRhLW5hbWU9IkxpdmVsbG8gMSIgc3R5bGU9ImZpbGw6I2ZmZjtmaWxsLXJ1bGU6ZXZlbm9kZCIvPjwvZz48L3N2Zz4=)\n![WebSocket](https://img.shields.io/badge/WebSocket-c?style=flat-square\u0026logoColor=ffffff\u0026color=ff6600\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHZpZXdCb3g9IjAgMCA0MjIgMzI1Ij48cGF0aCBmaWxsPSIjZmZmIiBkPSJNMzE3IDI0M2g1MlYxMTZsLTU5LTU5LTM2IDM4IDQyIDQzdjEwNXptNTIgMjdIMTg2bC00My00NSAxOS0xOCAzNiAzNmg3NGwtNzItNzQgMTgtMTggNzIgNzN2LTc1bC0zNC0zNCAxOC0yMC05MS05MUgwbDUzIDUzaDEwOWwzNyAzOC01NSA1Ni00MC0zOFY4M0g1M3Y1Mmw5MSA5MC0zOCAzNiA1OSA2MGgyNTdsLTUzLTUxeiIvPjwvc3ZnPg==)  \n\n**Add blazing-fast WebSocket support to Concrete CMS with ease! 🌈**\n\n![WebSocket Dashboard Screenshot](./docs/readme_screenshot.png)\n\n## 🎯 Features\n* 🌐 **Multiple WebSocket Servers**: Run and manage multiple servers simultaneously.\n* ⚡️ **Background Processes**: Keep your servers always online in the background.\n* 🔄 **Process Management**: Effortlessly start, stop, and manage server processes.\n* 🐧🪟 **Linux \u0026 Windows Support**: Seamlessly deploy on both operating systems. \n* 🎨 **Customization**: Tailor server port configuration to suit your unique requirements.\n* 🧩 **Built-in Middlewares**: Enhance server functionality with ease.\n* 🔒 **Secure REST API**: Manage servers remotely through a secure API.\n* 📚 **Comprehensive Docs \u0026 Examples**: Access detailed documentation and practical example.\n\n## 🚀 Installation\n* 📥 **Download** the [latest release](https://github.com/Samurai016/concrete_websocket/releases/latest) package (*concrete_websocket.zip*)  \n* 📂 **Unzip** the package in your /packages directory  \n* 🌐 **Visit** your website's \"Extend Concrete\" page  \n* 🚀 **Install** the package.  \n\n## 📚 Usage\nRun a custom WebSocket server effortlessly with our package. Based on [Ratchet PHP](http://socketo.me/), it opens up a world of real-time possibilities for your Concrete CMS site. 🚀  \n\u003e ⚠️ **Warning!**  \n\u003e The WebSocket servers are run outside Concrete environment, so, in the server class, you can't use classes or methods from the Concrete environment.\n\nFollow our [example README](https://github.com/Samurai016/concrete_websocket/blob/master/example/README.md) to create a custom WebSocket server.\n\n### 📊 Dashboard explaining\nThe package will automatically detect your server classes.  \n* 🟢 **Start**: Click the *Start* button to launch the server.  \nNow you can connect to your server via *ws://yourdomain:port/*\n* 🔴 **Stop**: Click the *Stop* button to halt the server.\n* 🔄 **Restart**: Click the *Restart* button to relaunch the server.\n\nThe **PID** column of the table is meant to be used for debugging and/or to track the process on your server.\n\n## 🔧 WebSocketServer class\n\n## 💡 Middlewares\nNew connections pass through the `getMiddlewares()` function, that returns an array of middlewares that are run as a LIFO queue (top to bottom).  \n\nEach middleware is defined by a [`Middleware`](https://github.com/Samurai016/concrete_websocket/blob/master/websocket/src/middleware/Middleware.php) object comprising:\n* `$class`: a class that must implements `Ratchet\\Http\\HttpServerInterface` interface.\n* `$params`: an array of params passed to the `$class` constructor when the middleware is built (on server start from the dashboard).\n\n### `ConcreteAuthentication` Middleware\nThe `ConcreteAuthentication` middleware restricts server access to logged-in users.\nIt checks the log status by querying a special endpoint defined by the package and closes the HTTP connection before protocol switching.\n\n### 🔧 On Open\nAfter the middlewares, the server switches to the WebSocket protocol, and the `onOpen` method is executed.\nThe base server's `onOpen` method adds the connection to the array of connected clients.  \nTo attach a connection, you can do it directly or by calling `parent::onOpen($conn);`.\n\nMore info [here](http://socketo.me/api/class-Ratchet.WebSocket.WsServer.html#_onOpen);\n\n### 🔧 On Message\nEvery time a message is sent from clients, the `onMessage` function is run.  \n\nMore info [here](http://socketo.me/api/class-Ratchet.WebSocket.WsServer.html#_onMessage);\n\n### 🔧 On Error\nEvery time an error occurs, the `onError` function is run.  \n\nMore info [here](http://socketo.me/api/class-Ratchet.WebSocket.WsServer.html#_onError);\n\n### 🔧 On Close\nEvery time a connection is closed, the `onClose` function is run.  \nThe base server `onClose` method remove the connection from the array of connected clients. So, if you want to detach a connection you can do it directly or by calling `parent::onClose($conn);`.\n\nMore info [here](http://socketo.me/api/class-Ratchet.WebSocket.WsServer.html#_onClose);\n\n## 🌐 REST API Documentation\n\nConcrete WebSocket come up with a built-in REST API that allows you to control and monitor your servers remotely.\nRefer to the [wiki](https://github.com/Samurai016/concrete_websocket/wiki/📚-REST-API-Documentation) for the documentation. ✨🔍\n\n## 🤔 FAQ\n\n### ❓ I got the `exec` disabled error, how can I enable it?\nEnabling `exec` (or its equivalents) is crucial for concrete_websocket, and the method to enable it varies among webservers.  \n\n\u003e concrete_websocket offers support for multiple methods, so it is not necessarily mandatory to have exec enabled but it is enough that even only one of the supported methods is.  \n\u003e **The supported methods are:**\n\u003e * [`exec`](https://www.php.net/manual/en/function.exec.php)\n\u003e * [`shell_exec`](https://www.php.net/manual/en/function.shell-exec.php)\n\u003e * [`system`](https://www.php.net/manual/en/function.system.php)\n\u003e * [`proc_open`](https://www.php.net/manual/en/function.proc-open.php)\n\u003e * [`passthru`](https://www.php.net/manual/en/function.passthru.php)\n\u003e * [`popen`](https://www.php.net/manual/en/function.popen.php)\n\nIn general, you have to edit the `disable_functions` directive in your `php.ini` configuration file.  \nRefer to your webserver's documentation for more information.\n\nIf you use one of the following admin panels, here are some useful links to edit the `php.ini`:\n* [🛠️ CPanel](https://docs.cpanel.net/knowledge-base/security/how-to-edit-your-php-ini-file/)\n* [🛠️ Plesk](https://support.plesk.com/hc/en-us/articles/213936565-How-to-find-and-edit-PHP-configuration-files-in-Plesk-for-a-domain-or-for-global-PHP-handler)\n* 🛠️ ISPConfig  \nYou can edit php.ini for each site by modifying the field `Custom php.ini settings` in the _Options_ tab of the site page.\n\nIf you've made the changes but don't see them applied to your site, you may need to restart your webserver. 🔄\n\n### ❌ I am unable to connect to WebSocket server due to insecure connection  \nWhen you try to connect to a `ws://` unsecure connection from an `https://` secure connection, you may run into the following error message in the console:\n```text\nMixed Content: The page at '...' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://...'. This request has been blocked; this endpoint must be available over WSS.\n```\nThis is because your browser prevent running unsecure connection from a secure environment.  \n\nThe easiest way to solve this is to configure a proxy server.\n\nFor Apache server (source: [StackOverflow](https://stackoverflow.com/questions/16979793/php-ratchet-websocket-ssl-connect#answer-28393526)):\n* Enable `mod_proxy.so` and `mod_proxy_wstunnel.so`\n* Add this lines to your `httpd.conf` file:\n  ```\n  ProxyPass /wss/ ws://yourdomain.com:port/\n  ProxyPassReverse /wss/ ws://yourdomain.com:port/\n  ```\n* Restart your server with\n  ```bash\n  sudo systemctl restart apache2\n  ```\n* Now, instead of connecting to `wss://yourdomain.com:port/`, connect to `wss://yourdomain.com/wss` (without specifying the port and add the /wss path) 🔒\n\nFor Nginx users, [this solution](https://stackoverflow.com/questions/16979793/php-ratchet-websocket-ssl-connect#answer-43012985) may work, but I haven't personally tested it, so I can't guarantee its effectiveness. 🚀\n\n### 🔍 concrete_websocket can't find my PHP executable path.\nTo configure concrete_websocket properly, you need to provide the PHP executable path of your server.  \nDuring the package installation, we attempt to detect it automatically, but **there are cases where it might not be found**.  \nIn such situations, we ask you to manually provide the path in the WebSocket Dashboard settings form. 🛠️\n\n❓**But how can you find your PHP executable path?**  \nHere are the steps depending on your operating system and installation method:\n\n#### 🪟 For Windows servers\n1. Open the `cmd` command prompt.\n2. Enter the following command in the prompt and press `Enter`:\n   ```bash\n   where php\n   ```\n   This command will display the path to the PHP executable. Copy and paste this path into the Concrete Dashboard settings form. 🖥️💻\n\n#### 🐧 For Linux servers\n1. Open the terminal.\n2. Enter the following command in the terminal and press `Enter`:\n   ```bash\n   which php\n   ```\n   This command will display the path to the PHP executable. Copy and paste this path into the Concrete Dashboard settings form. 🖥️💻\n\nKeep in mind that the provided solution is general and might not be applicable to your specific server setup. The exact answer depends on your configuration. ✨","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamurai016%2Fconcrete_websocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamurai016%2Fconcrete_websocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamurai016%2Fconcrete_websocket/lists"}