Plugs for channels?

So after playing around with channels one very quickly starts to add all kind of things, from security to data and channel dispatchers etc. until one realizes “hey, why I can not use plugs for channels?” - Can I?

I am not sure if I understand things well, but channels seem to be not integrated into the plug architecture, am I right?

Wouldn’t it make sense to have plugs for channels? Is there some work going on in this direction?


Plug is to handle stateless requests. Channels on the other hand are neither stateless, nor do they map to a sequence of HTTP requests, they are steady connections, which are kept alive after beeing established. Plug can’t handle this, since it wants to have controll over the complete “request/response” cycle of a request which does happen only once per connection.

In a channel request and response are somewhat interleaved and asynchronous.


HI, tthanks for your answer!

Yes, I understand the concepts of stateless http vs. websockets.

However, it would be great if the abstractions that the plug concept provides to http would be available in a similar mechanism to channels. You want to do something with the messages that go in / out and finally you are rebuilding things that are doing similar stuff like plugs do.

1 Like