I recently wrote about WidgetBox breaking my live stock quote widget by disallowing data in CSV text format when using their proxied XML-HTTP request functionality. (See "WidgetBox tightens up AJAX interface")
As an alternative, I set up a Yahoo! pipe to supply the data in RSS format, which seemed to work well.
The problem is when a person stays on the page hosting the widget in order to watch the quotes update throughput the day. After half an hour or so, the widget stops working. There appears to be some kind of strange caching going on that prevents any data from being returned. I tried the usual work-around: appending in the query string a key/value pair containing a random number but to no avail.
My eventual solution was to create a Google gadget with the same logic that retrieved data from the original source in CSV text format. This gadget was then embedded inside the WidgetBox widget.
With a little fooling around, I was able to pass the user configuration data through the WidgetBox widget to the Google widget and, once again, things seem to be working fine.
The bottom line is that RSS just does not seem to lend itself to continuous data retrieval for applications like real-time quotes. It is hard to be sure exactly where the problem lies but either WidgetBox or Yahoo! or both treat RSS as an information feed, not a raw data feed. As such, the assumption is that one wouldn't want to continuously retrieve an RSS feed as I have been trying to do.
We just experienced a major problem with the widgets that retrieve stock quotes from Yahoo finance.
It is fixed now but it was a frustrating experience while I was trying to correct the situation. Here is what I believe happened.
The widgets used a proxied XML-HTTP request via the WidgetBox servers that allows us to retrieve data from the Yahoo domain no matter what domain is displaying the widget. It appears that WidgetBox has tightened up their criteria as to what constitutes a valid XML-HTTP response. We were retrieving plain text, no XML at all, and it stopped working.
Our solution was to create a Yahoo Pipe that retrieved the text-based data and transformed it into an RSS feed. This was done by renaming the fields to comply with the typical RSS structure and then render it as RSS. We had to cheat a little here. The fieldnames that can be used are as follows: title, description, category and link. We mapped our stock data to these four fields. Luckily, the content doesn't matter so we can use these four fields for any data item we wish.
In any case, WidgetBox is happy to pull in the RSS as an XML-HTTP response. We are then able to pick up the data from the nodes in the XML response and display it as needed. Problem solved.