Some of you might know that we are working on a chat application. (The initial beta version will soon be released! Wooh!)
How it has been set up, is that the main chat server only has as goal to communicate with clients running in the user’s browser. This chat server itself does not do any HTML rendering (the front-end rendering code is on other people’s servers), and so will, besides sending one or two static JS files, only communicate using Phoenix Channels.
So I was wondering: Are there parts of Phoenix that can be turned off, or configured in such a way that it works extra well for channel-based communication?
Bah, I wrote the below thinking you were only using websockets–obviously you can’t drop Phoenix altogether and still use Phoenix Channels.
You could probably just drop Phoenix altogether and use Plug. I personally wouldn’t, because somewhere down the line you’re going to discover that in fact you don’t want a pure channels application. You’re going to want to respond to some plain HTTP requests: /healthcheck, /ready, /ping, etc. You might even want to serve some HTML: /admin/…
Channel transport connections are intercepted at the top of the endpoint, thus bypassing your plug pipeline, so there’s nothing to optimize. Even if you later decide to serve up other http requests, there won’t be a concern for such features impacting your channel performance.