LiveView with different clients

I currently am working with a system where we have a REST API (Django) with a separate React application that makes use of the API. The API provides sockets for clients to subscribe to changes to data, so that all connected clients get updated when data changes server side.

I am investigating porting the API side to Elixir. I’m fairly new to Elixir, but have been using it for a while now.
LiveView is pretty much the equivalent to the sockets mentioned above, but I have not found any info on whether any client can connect to these sockets or only the Phoenix application itself.

Is it possible to connect the React application to the Liveview sockets as you would with any other websocket, or are there any caveats I should be aware of?

LiveView isn’t the equivalent of sockets, rather a technique for server rendering the client html basically. It does so on regular http requests and it can keep the state of the client up to date and interacts with the server through the sockets, but you don’t handle them yourself.

You should probably look more into Phoenix Channels which is the abstraction over sockets which is really nice. Phoenix includes a js client to easily set it up. You can reed up on the docs here: https://hexdocs.pm/phoenix/channels.html#tying-it-all-together

3 Likes