Phalcon and Socket.io

I want to try socket.io for the first time. I did the tutorial chat message with socket.io. But now I want to select some data in my database to count the number of rows in the table 'product' with query Phalcon :

$count_products = Product::count();

For example in my HTML page I have 5 products and when I'll add one product or more into my table Product I want an auto refresh to see 6 products in my HTML page.

I need to do an query to my database with phalcon and push to socket.io the data to do a realtime update.

could you help me to do that and tell me if socket.io is the best tools to conncect web socket with phalcon ?

You realize that socket.io is nodejs server, and you have client lib written in js which handles client communication? Phalcon is by chance also server side application stack. So, it depends what you want to achieve.

You realize that socket.io is nodejs server, and you have client lib written in js which handles client communication? Phalcon is by chance also server side application stack. So, it depends what you want to achieve.

Client -> Socket.io -> Phalcon

you will post updates to the message queue from both ends, and list fro updates at both ends. Socket.io is nothing more than a message broker.

Socket.io will sit their and listen for messages on its channels. when a message happens you logic inside socket io will tell it what to do with those messages. Be it distribute those messages to listening subscribers or any other system. Asking if "X" is the best thing to do it with, wiht ushc little context is a bad question.

If all you are doing is retrieving and updateing data from a datbase why choose phalcon ?

What are you using for your UI on the fornt end?

You could acheive the same result with a 2 part system using React + firebase for instance.

Without more details on your contraints its hard to say what is the "Best" tool for the job.