0

I'm optimizing a stock market application that I built and wanted to improve the performance of stock data. The application has streaming quotes, but I'm requesting the quotes each second, which seems quite bad.

I took a look at Google Finance's stock charts and notices they used something called a "channel." Is this essentially just requesting stock quotes every like 15 seconds? Is it possible to keep the connection open and continue to grab quotes or do I have to use a new request each time?

  • Sounds like you're looking for [web sockets](http://en.wikipedia.org/wiki/WebSocket). I know [_node.js_](http://nodejs.org/) has a nice socket library [_socket.io_](http://socket.io/) that can be used for real-time data transfers. _.NET_ applications have a nice library too called _SignalR_ that does the same thing. Unfortunately, I don't know of a way to do this in PHP. It wasn't designed for socket/keep alive connections. I've never personally used any of them though so that's about as far as I can steer you... – War10ck Apr 24 '14 at 20:04
  • @War10ck Interesting, I will research further on this. –  Apr 24 '14 at 20:06
  • Let me know if you find any good articles. I've been wanting to look into sockets for a real-time chat web app that I made. Unfortunately I just haven't had the time. I'd be interested to know what you find out. – War10ck Apr 24 '14 at 20:07
  • @War10ck I'll let you know what I end up using, I'm definitely not going back to a new request every second, that was horrific! :D –  Apr 24 '14 at 20:08
  • I can imagine. I'm sure whoever you were requesting the quotes from would agree as well. – War10ck Apr 24 '14 at 20:09
  • @War10ck surprisingly yahoo api didn't block me lol, but I definitely want to take a better approach. I will read through the W3C WebSocket http://dev.w3.org/html5/websockets/, http://stackoverflow.com/questions/1736382/how-to-use-sockets-in-javascript-html. –  Apr 24 '14 at 20:13

0 Answers0