Supporting the Phoenix 1.7 update is proving fairly tricky because there’s a large update to how we sockets work under the hood. I have started the work to update but it isn’t complete yet (and hasn’t been pushed up to GitHub). MainProxy will be updated to support Phoenix 1.7 but I can’t make any promises as to when.
In theory: everything that comes into Phoenix now does so via either Plug or WebSock. Specifically, WebSocket upgrades are entirely mediated through Plug, and the resultant connections are managed via WebSock. This is why Phoenix.Endpoint.Cowboy2Handler has gone away; its only purpose was to shim Cowboy’s WebSocket support (both the process of upgrading & also managing the subsequent connections). Phoenix no longer exposes a Cowboy Handler implementation because it doesn’t need to.
The problem here is that MainProxy is (to my understanding) fundamentally concerned with routing to Cowboy handlers. To the extent that it seems to support ‘raw plugs’, this should be enough to do everything that Phoenix 1.7 needs. I can’t back that up with anything beyond a fairly broad architectural wave of the hand, however; I haven’t looked at MainProxy’s code in any really depth (though axelson and I have talked about this before).
All of this is also to say that the functionality of MainProxy (at least insofar as it proxies to Phoenix / Plug apps) could probably be subsumed by Plug.Router, since everything is just a Plug now. This would come with the side benefit of being functional on all servers, not just Cowboy (again, architectural handwaving abounds in this statement).
@mtrudel Thanks for all the improvements you made to Phoenix 1.7 (e.g. websock)! It definitely makes MainProxy pretty much unnecessary (which I plan to note in its readme in the future). Although it does still seem a bit easier because MainProxy takes care of running a base plug for you since calling another Phoenix Endpoint from within a Phoenix Endpoint doesn’t work for websockets in my testing.
Edit: And also thanks for giving me pointers on the upgrade @mtrudel