My question is about logic not api specific.
if I have an e-commerce application that consist of 2 separate components (one is for the seller and the other for the buyers) and I have, lets say, laravel php admin panel for customer support (as super admin) and amdin panel for sellers can use web browser to edit their product pages and reply to customer in realtime. (now sellers has 2 options android app and web page to do same job)
How the hosting is done for the website (admin page) and android application, according to my understanding is:
1- admin panel (webpage) will be on server hosting the Laravel and MySQL database.
2- Android application will retrieve data from database from server.
3- when sellers use their android application to add products.. Database on server will be updated.. so buyers can see the new added items.
4-When Buyers uses the chat interface in android application then this database will not use the server where the Laravel (or any framework) admin page are hosted.. instead it will connect to real time plateform like firebase.
That is my understanding for this type of application and the overall relations between web server and android app.. Is that logic is right? please any advise will be helpful.
I was using pusher for my realtime chat, you can store messages in your database and broadcast MessageSent event with pusher, listen channel on front of your website/app and append chat with received info from pusher.
You have to make 2 channels
Broadcast::channel('/user/chat/{userId}', function ($user) {
return $user->id === $userId;
});
Broadcast::channel('/admin/chat', function () {
return $user->isAdmin === 1;
});
and broadcast user messages to /admin/chat
route and admin replies to /user/chat/{userId}
, hope it helps
Read docs: https://laravel.com/docs/5.7/broadcasting