Does Daphne replace uWSGI?

I am trying to understand what is required to migrate from uWSGI to Daphne (so I can use websockets.

From what I read:

Daphne is a HTTP, HTTP2 and WebSocket protocol server for ASGI and ASGI-HTTP, developed to power Django Channels.

Since its a HTTP protocol server, does that mean it can replace uWSGI? So I don’t need uWSGI anymore, I can just Daphne?

I have read a few posts about how to setup Daphne and uWSGI, by why would one want to have both when one will do?

I use uWSGI with Nginx if thats applicable.

Yes, Daphne can replace uWSGI.

However, I don’t use it like that. For my applications, Daphne only handles the websocket connections, all regular requests go through uWSGI.

I remember reading somewhere, at some point in time in the past, about some issues with there being some overall benefit by separating the two functions. (Yes I know that’s too vague to be useful, but I can’t find my notes on the topic at the moment. It had something to do with threads being blocked at certain points, affecting the responsiveness of the channels.)

Anyway, once I got comfortable with the joint deployments, that’s how I do it now and not worry about it.

In principle, I also like doing it this way in that it would let me replace either uwsgi or Daphne with something else and not affect the other. Or, move the websocket handler to a different server(s).

2 Likes