So I am totally confused on what to do. So I am creating a messaging app for my project which also uses a Php Api, so now i want to implement that but I am totally confused on how to do it?
So here are my ideas
Idea 1:
Use Php as backend and use Api (CRUD) to check for messages sent by the client to another client (There will be around 100-500 Users)
Idea 2:
Use C# sockets. When User comes online he will connect to server and store its Ip + port in database and using that client will communication (Havent tried this just assuming it will work)
So which one is better/worse and what is your solution
Hey
Ok so here is my solution to my own problem.
If the users are less users then u can go with REST but for an efficient performance go with Sockets I changed from Php to ASP Net Signal R backend. And with a little help from tutorials and documentation you are good to go
Answers
@HussainMurtaza urtaza
If it's instant chat messaging, it's better to use the C# Sockets for " real-time ".
For me, the plus to use C# sockets is you can know which users are connected to the socket server. With Http protocol, you can't know.
You don't need to store IP and port. You need to identify the client, so just request identification. (nickname for example).
Now you know:
With theses informations, if a user send to a connected user a message, your socket server will receive the message and will transmit to the good recipient.
If user isn't connected, you can store it in database and when user is connected you send offline messages to him.
Hope this helps.
@HussainMurtaza Ow.. yea you can create sockets with PHP. You can use PHP command line interface to start your socket server.
Check here.
Also I am using slim framework for rest api
@HussainMurtaza
The php script will run until you close the page. You need to keep 24/24... bad thing.
Using a php API (JSON for example) is better for your case.
Hello there!
I am here with the same question.
I would like to implement a one-one messaging solution, basically it is a chat. I have c# client - Xamarin forms. And - right now - a PHP backend. How would you efficiently implement this?
Probable solution:
Hey
Ok so here is my solution to my own problem.
If the users are less users then u can go with REST but for an efficient performance go with Sockets I changed from Php to ASP Net Signal R backend. And with a little help from tutorials and documentation you are good to go