Elixir/Phoenix Channel based chat application


I am currently investigating into writing a real time chat application in Elixir/Phoenix. I have a few queries before I jump into choosing a particular technology. Please see and answer my below queries -

  1. Is WebSocket the standard for writing real time chat applications or can I use gRPC or is there any better transport mechanism?

  2. How does Elixir/Phoenix Channel compares to other technologies or services like

    • Firestore
    • Pusher
    • Anycable
    • Action Cable
  3. If I decide to go with Elixir/Phoenix Channel, how can I run multiple instances of chat application on Kubernetes pods? Can someone points me to any document/article on this deployment part?

  4. Is there any hidden problem using WebSocket with multiple instances of chat applications that I should know about - like security/stability/scalability/performance?

Awaiting some response.


Came across this article - https://samsaffron.com/archive/2015/12/29/websockets-caution-required

Even though a bit old would like to know where WebSockets in general but Phoenix Channels in particular stands with respect to the views expressed in above link.


Websocket is one of the reason why I started Phoenix, coming from Rails…

1 If You use Phoenix, it might… but You can use other protocol
2. Firestore. Pusher. Anycable are all external services. Actioncable… Phoenix channel, hmmm, cannot be compared
3. Distribution is one aspect of the BEAM, but it’s not easy to setup
4. Websocket is just the transport

Sorry to tell, but a chat app is just the hello world application in Phoenix. If Rails promotion video is about building a blog in 15 minutes, Phoenix one could be how to build a chat in 15 minutes.

Websocket is just the transport, but Elixir has building blocks for chat application.

You should really try to build one. And You will see it’s easy because of the tools the BEAM provides.

There was a lecture about building a chat in Erlang before Phoenix even existed, unfortunately it is outdated now.


The article You posted is about Ruby…

Update: I guess You can make it in less than 15 minutes… :slight_smile:


Hi @kokolegorille, thanks for your reply.

Regarding point 3 - I have come across the below articles -

Looks like using Redis Pub/Sub it’s not that complicated to setup. However, using PG2 adapter can be a bit complicated.


1 Like

These posts have been made by @alvises :slight_smile:

1 Like

Thanks for the great articles @alvises

1 Like

WebSocket is a great transport mechanism and is what I’d recommend generally across the board today. Phoenix has its own protocol on top of WebSockets, but you could implement something like gRPC messages if you wanted. I have never needed to do that.

Redis PubSub works great, but I wouldn’t shy away from the out-of-the-box pg implementation. It’s really not bad to setup in Kubernetes.

There can be lots of caveats with any technology, WebSocket included. Real-Time Phoenix tries to capture those gotchas as much as possible.

1 Like

Thanks @sb8244. I agree with you. I will try to read your book :slight_smile:

1 Like

I’d suggest to go for, at the beginning, with the default PG2 adapter avoiding to maintain a redis server as well.

1 Like