L
L
laponov2017-02-28 17:53:04
PHP
laponov, 2017-02-28 17:53:04

How to make user notifications with php (crown task) in socket.io?

Tasks are executed in the cron - once a minute, we want that when some actions occur in the cron, a real-time notification is sent (if the user is still on the site)
There is node.js + socket.io on the server - we have the identifier of a specific connected user.
There is no problem with the sockets themselves, but we can’t figure out how to send a notification from php.
One of the options is to send a request to the node via http ( example.com:1234/notiffication=USERID) so that it, in turn, already sends an emit to a specific user, but something tells me that this option is not entirely correct ..

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
ajaxtelamonid, 2017-03-16
@ajaxtelamonid

Redis is used to communicate between php and nodes. We write to the radish what needs to be sent, the node listens to the radish and sends what it finds. Google solutions.

Y
Yuri, 2017-02-28
@riky

it would be more logical to do all this in a node instead of php + cron.

A
Alexander Novikov, 2017-02-28
@AlexndrNovikov

If you understand the problem correctly, you can try this

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question