https://github.com/nemiah/phpOverWebsocket Skip to content Sign up * Why GitHub? Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Project management - + Integrations - + GitHub Sponsors - + Customer stories- + Security - * Team * Enterprise * Explore + Explore GitHub - Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing Plans - + Compare plans - + Contact Sales - + Nonprofit - + Education - [ ] [search-key] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this user All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} nemiah / phpOverWebsocket * Notifications * Star 6 * Fork 0 Execute php files over websocket connection AGPL-3.0 License 6 stars 0 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights main Switch branches/tags [ ] Branches Tags Nothing to show {{ refName }} default View all branches Nothing to show {{ refName }} default View all tags 1 branch 0 tags Go to file Code Clone HTTPS GitHub CLI [https://github.com/n] Use Git or checkout with SVN using the web URL. [gh repo clone nemiah] Work fast with our official CLI. Learn more. * Open with GitHub Desktop * Download ZIP Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Go back Launching Xcode If nothing happens, download Xcode and try again. Go back Launching Visual Studio If nothing happens, download the GitHub extension for Visual Studio and try again. Go back Latest commit @nemiah nemiah php-cgi has to be available ... da94bb9 Mar 2, 2021 php-cgi has to be available da94bb9 Git stats * 4 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time examples initial commit Mar 2, 2021 src initial commit Mar 2, 2021 .gitignore initial commit Mar 2, 2021 LICENSE Initial commit Mar 1, 2021 README.md php-cgi has to be available Mar 2, 2021 composer.json initial commit Mar 2, 2021 composer.lock initial commit Mar 2, 2021 phpOverWebsocket.js initial commit Mar 2, 2021 server.php initial commit Mar 2, 2021 View code README.md phpOverWebsocket After reading The Future of Web Software Is HTML-over-WebSockets I asked myself if it would be possible to replace HTML Ajax/fetch calls with a websocket connection and execute PHP directly without Apache or Nginx in between. This is a proof of concept, that it does work! :) It also includes transferring the session id to get the same user session when executing the script over the websocket connection. A webserver is still required to deliver the initial index.php but as soon as the websocket connection is open, all requests are handled over websocket. The effect on localhost is rather small but I think in a real environment with network latency it should shave off a few milliseconds. With the added benefit that there is a channel open to push changes to the client any time. I wrote this on a single weekend. This is only a proof of concept and has probably multiple problems and unconsidered security concerns. Try it yourself apt install php-cgi #The command php-cgi has to be available! git clone https://github.com/nemiah/phpOverWebsocket.git cd phpOverWebsocket #download composer... php composer.phar install php server.php examples This should set up a Ratchet websocket server and run it with my minimal example. Open /examples/index.php in your browser. When the connection to the websocket server is established, a click on the button will send the request over the websocket. If you kill the server the request will be sent with fetch(). The result will be the same nonetheless. About Execute php files over websocket connection Resources Readme License AGPL-3.0 License Releases No releases published Packages 0 No packages published Languages * PHP 67.0% * JavaScript 33.0% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.