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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.