Hello everyone,
I'm curious what PHP developers think about a different way to use WebSockets from scripts.
Imagine requesting (e.g. GET):
new WebSocket("ws://device.local/settings.php?key=value");
The server handles the WebSocket upgrade and then executes settings .php as regular PHP script, but with its IO redirected through WebSocket framing:
STDIN reads incoming WebSocket data.
STDOUT and echo sends data back to the client.
No special WebSocket classes, event loops ,callbacks etc are required in the script. It just runs and communicates through its input/output streams (e.g. via fread() ), the server provides all necessary framing for wth ws:// protocol.
For some context: I am researching an alternative PHP-like language, mainly for embedded devices.…