I’m looking for ideas on how I can implement the part of an application that sends a chat message from server to client without using phoenix and live view.
Phoenix provides one of the easiest experiences for setting this up imo. Is there a reason why you don’t want to use Phoenix?
Cowboy is the underlying web server for Phoenix. You can find an example of using EventSource here. It provides unidirectional communication from client to server.
Set up a websocket channel
TCP or UDP? But seriously websocket with cowboy is really simple to setup.
Phoenix is an option. I want to understand what all options out there are. xmpp seems like it’s purpose built for chat. What if I didn’t want to use xmpp? I’m wondering if I can do what is done in xmpp with straight erlang/elixir?
Sending a chat message from server to client is one example of a feature I’m trying to build.
Another example is when building a game you send partial updates from server to client. I have seen phoenix examples of this such as the game of life examples out there with https://github.com/SimoneStefani/game-of-life
Simple question that came to my mind: Are you referring to web-only solutions, or any client? Options would vary a lot when you have your own client.
The other thing that comes to mind is this: Is there an open source project that has chat that can handle millions of users?
This existing project looks interesting: https://github.com/dbeck/chatter_ex
For web clients, the only options are websockets and long polling. Nothing else you can do about them.
For other clients, solutions are countless. From websockets to custom made protocols over TCP/UDP, anything could work, as long as you are the one writing the client.
I don’t quite get what you are after.
As for open source chat projects, look into ejabberd. XMPP server written in Erlang, handling many connections just fine.