We are running the same django project in WSGI mode for handling HTTP requests and in ASGI mode for handling WebSockets. For WSGI mode we are using gunicorn3 server:
gunicorn3 --pythonpath . -b 0.0.0.0:8000 chat_bot.wsgi:application
For ASGI mode we are using daphne server:
daphne --root-path . -b 0.0.0.0 -p 8001 chat_bot.asgi:application
How to programatically detect which mode currently is running GreenUnicorn+WSGI or Daphne+ASGI?