D
D
Dmitry Kuznetsov2018-09-27 14:53:33
PHP
Dmitry Kuznetsov, 2018-09-27 14:53:33

How to make your own corporate WhatsAPP (SocketJS)?

Good day! For the enterprise in which I now work, it is necessary to write a program ala WhatsApp. Because I am not strong in other programming languages, but I only know the basics of PHP / SQL and JS, it was decided to write in them. I will take Laravel (for API) as Backend, and I want to take VueJS (ElectronJS) for frontend.
And here I immediately wonder about the transfer of messages from the client to the client (clients). Those. the functionality will be very similar to WhatsApp (transfer of text, audio-video files, etc.). After reading a couple of articles, I realized that it is better to use sockets (JS) for this. But then there are more questions that I would like to get answers to:
1. What power does the socket server need to support 100 simultaneous users (meaning sending messages / files to 100 people at the same time).
2. Is it difficult to make the so-called "rooms"? If there is a link on this topic, it would be great.
3. How to bind Laravel (API) to work with sockets? You need to get user data, rights, etc.
4. Will it be difficult to scale the network? Yes, I know, it's too early to talk about scaling, but you need to know right away.
5. How to correctly save user messages in the database (MySQL)?
6. Are there any pitfalls here?
PS: This creation of Frankinstein will work on the Internet.
I ask you right away - please do not write something like "You can't", "Learn languages", etc. Because I have no choice - they told me to do it - so I need to do it (and don't ask why ...).
Thanks in advance for your comments and replies!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander Taratin, 2018-09-27
@Taraflex

Didn't you think to just raise your matrix server for riot.im?
https://gist.github.com/attacus/cb5c8a53380ca755b1...

G
grinat, 2018-09-28
@grinat

https://reactphp.org/
There will be problems with demons, in general, the point is that you need to separately raise a process on php that will listen to the socket and send a response, php is poorly suited for this, it will fall, etc. supervisord will save here
. But I don’t advise you to contact this at all, I recommend: https://github.com/centrifugal/centrifugo there is a server on go, and ready-made libraries for js, everything you need comes out of the box.
And it makes no sense to receive everything through sockets. In fact, it makes sense to use them only for delivering messages / statuses, and create photos / rooms / new messages through the rest api. Well, that is, a person created messages, it went to restapi, in restapi we save it to the database and send a message, for example, to centrifugo so that it sends this message to all interested recipients via a socket. If you send everything through sockets, you will get a bunch of hemorrhoids. If everything is through sockets, then it’s better to take apolo right away in conjunction with graphql or meteor

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question