I have a php socket server that I use to handle messages from a modem. I want to create a php websocket server and whenever I receive a message from the modem I send it to a webclient. I'm a couple days trying to do it without success.
How is the best way to do it? Thanks
.
Here is the way I want to do:
Modem ------> PHP Socket Server ------> Web Clients
v
database
But if you have another best way to do it, tell me.
Thankyou again.
EDITED: This is an alternative for socket_read errors in non-blocking socket: http://php.net/manual/pt_BR/function.socket-read.php#73509
You can do it with non-blocking socket and long polling technique.
The workflow is something like this.
I had a similar situation months ago. I had to keep web sessions in PHP and there was another server which PHP was connected too. Couldn't finished it. Later I had to move to Python for this.