I have a PHP app and I need to add a chat to it.
I already did one approach where I use Phoenix as an API and I send via PHP API calls in order for Phoenix to broadcast messages to the socket.
So the user types a message, hits enter, I save it to the DB via PHP, and then send the API call to Phoenix to broadcast that message to all connected users.
In this approach Phoenix has no connection to my database at all. It only broadcast messages. Kind of like the service pusher.com offers.
The other approach is to let Phoenix to connect to my DB and control the whole socket.
My question is, how much different the performance will be?