N
N
Nikolay Alekseev2020-06-02 18:29:00
PHP
Nikolay Alekseev, 2020-06-02 18:29:00

Is it possible to send data from php to Node.JS running webcocket server?

Good day to all!

The question is very hypothetical, very spherical and heavily in a vacuum, but while I'm designing a new project, I would like to understand the possibilities that I can use.

The bottom line is this: there is a client - this is a regular web page on which JS works, connecting to the node via a web socket. They change messages there as needed and they feel good.

There is another part of the project, written in php, which performs, let's say, administrative functions. And at some point in time, I need this "admin panel" to notify the client about something. Actually, I see several options:

  1. Just write the data to the database, and let the server on the node periodically check them, find something new, and tell the client.
  2. from under php at the right time, connect to the node via websockets, tell it everything that it needs to know and disconnect, and it already tells the client about everything.
  3. And here he interests me most of all, is it real? Just send a post request to the node. She catches it and tells the client about the find.


But in view of the fact that I have been working with the node for about the third day, my knowledge is extremely meager and I have no idea how it works at all and whether it is possible to do so.

I would be grateful for any advice.

Perhaps I am generally inventing a bicycle and all this is superfluous and can be made simpler. Just please do not suggest using ready-made services for this, a la Pusher. In this case, this is not an option.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg, 2020-06-02
@VariusRain

https://ru.wikipedia.org/wiki/%D0%9E%D1%87%D0%B5%D...
Choose a broker according to your taste Choose
pairs of npm libraries for node.js and packagist for PHP
https://www .npmjs.com/package/rabid
https://packagist.org/packages/php-amqplib/rabbitm...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question