joewalnes / websocketd

Turn any program that uses STDIN/STDOUT into a WebSocket server. Like inetd, but for WebSockets.
http://websocketd.com/
BSD 2-Clause "Simplified" License
17.17k stars 1.02k forks source link

Rewriting mechanic #447

Open TuzelKO opened 5 months ago

TuzelKO commented 5 months ago

Hello! It would be useful to implement a rewrite mechanism, thanks to which different addresses could be passed to a single entry point, as does e.g. Nginx.

For example, I have several addresses: ws://ip:port/category1/action1, ws://ip:port/category1/action2, ws://ip:port/category2/action1... I would like all these connections to be poured into one script, and the path to be passed, for example, as a launch argument, so that the script’s internal router can decide what to do.

This function will allow you to easily integrate many PHP frameworks with WebSocketD.You can also make the setting with one argument at startup (--url-to-argv or --url-rewriting). The launched script will in turn receive this address as the first argument (php my-ws-script.php "/path/from/address")

mathieu-aubin commented 3 months ago

nothing nginx could potentially accomplish? Maybe? https://nginx.org/en/docs/http/websocket.html on websockets but combined with nginx capabilities...