I want to stream live XML data (say stock prices) to a TCP socket on a web server. I then want users to be able to connect to a webpage and see the (updated) version of the latest data. What do I need to do?
I’m most comfortable with PHP so:
- Write a script that runs on the server and listens to the socket.
- When it receives new data (which will be every second) it parses it into the right format (say: name, price, change)
- ?????
- Have a webpage that has a table of the latest data
- Use pusher.js (or something) to listen for changes to the data?
PHP Is not good solution for that. Take a look at node.js or vert.x. With Websockets you can transmit data. Its more effizient then PHP-Sockets.