Equivalent of websocket directive for normal web request

I just playing around with the websocket directive:-

websocket /ws "python ws.py"

And the python script ws.py:-

import sys
import time

while True:
  if line:

Impressing ! But now if I need to listen to some webhook as part of this websocket app, I need to run python app server and proxy it from caddy. Why can’t we have similar directive to process normal web request like above too ?

Like the proxy directive does? Or you mean something that goes to stdin? If so, probably because there hasn’t been any demand for it…

Using proxy require me to manage another process. In websocket example above, it run python ws.py when there’s incoming connection, and then terminate it when the connection closed. But thinking further about this started to feel like this is exactly what CGI is.

Yep, basically. :slight_smile: The websocket directive even implements a subset of the CGI spec.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.