C
C
Cyril2017-09-12 19:54:57
Yii
Cyril, 2017-09-12 19:54:57

Is it necessary to use Node.js to work with sockets?

The backend of the project is the YII2 Framework with a public application ( YII Frontend ), an "admin" ( YII Backend ) and a module ( YII module ) that provides a REST API.
The public application ( YII Frontend ) is implemented partly with static html (displaying normal views), and partly using Angular and Vue.js. And the admin panel ( YII Backend ) is implemented entirely in Angular.
Those parts of a public application that are implemented in Angular communicate with the server through the REST API. And the admin communicates with the server only through the REST API.
There was a need to write native iOS and Android applications with the ability to display dynamically changing information in real time. For example, a user with the role Role 1 in the mobile application has changed the status of the object Object 1 . The user with the role Role 2 immediately saw this. Obviously, this requires the use of sockets.
Tell me, please, is it worth using Node.js for such a task, if the entire project is implemented only in PHP? Can organize sockets with PHP? How effective will it be for a large number of users? As far as I know, Node.js is much better suited for a very large number of socket connections than the PHP solution.
After all, for sure, in Enterprise projects, not PHP, but Node.js, would be chosen as a socket server.
Thank you!

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Serezha, 2017-09-12
Ahen @Ahen

socketo.me

S
Sergeyj, 2017-09-12
@sayber

It is possible in PHP, using the same Ratchet .
There is a desire, it is possible on a node, and even better Go.
I did it on all options, I didn’t notice much difference, at 20k hits per minute.
Under heavy loads, the puff of course gives up and the memory to sit down.

C
catanfa, 2017-10-14
@catanfa

recently conducted an analysis of options for solving this typical task, the choice fell on the project https://github.com/centrifugal/centrifugo - very convenient, good documentation, excellent performance, modern, maintained. It is worth noting that at the time when I talked with the creator of this framework, it was impossible to transfer data from the client to the server via web sockets. But often this is not necessary for the solution.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question