liveforeverx on irc has answered my original question and I have modified this question as a followup.
Phoenix depends on Plug for many of its function. However, when it comes to starting cowboy server, why doesn't Phoenix start it using Plug's api in Phoenix.Endpoint.CowboyHandler.start_link? Why does start_link on ranch_listener_sup is called instead?
Is it because of any limitation of Plug or is it because Phoenix started this way much before Plug's api got matured?
My Original Question:
How/where does Phoenix start cowboy?
Reading the Plug docs, I see that to start a server, one has to call
Plug.Adapters.Cowboy.http/3
However, grepping through my phoenix app and the phoenix source code, I do not see any instance of call to Plug.Adapters.Cowboy.http/3. How/where does Phoenix start cowboy?
Two reasons:
To support websockets
Because Phoenix starts the server inside your application supervision tree instead of running your app inside Cowboy
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With