Click here to show or hide the menubar.

Home >  Archive >  2010 >  December >  1

Previous / Next

A server for testing FeedHose apps
By Dave Winer on Wednesday, December 01, 2010 at 4:57 PM.

In the server mess I had to take the FeedHose server off the air so I could reorganize things. Now I'm ready to turn it on again. permalink

This server is for testing for interop only. Please don't build serious systems on it. :-) permalink

The default hose on this server is Hacker News. permalink

The main entrypoint is the default page. It's meant to be called from an application. It's a long-poll, meaning it returns when something new is available from the indicated hose, or if it times out. In either case you're expected to loop back around and call it again. permalink

Here's an example call that times out after three seconds, returns JSON-formatted news from Hacker News. (If no new stories came in during the three seconds, which is almost a certainty, you'll just get metadata.) permalink

There are four optional parameters, all of which have defaults: permalink

1. name, is the name of the hose you're inquiring about. If it's not specified the information returned is about the default hose (on this server, Hacker News). permalink

2. timeout, is the number of seconds before the call times out. If it's not specified, the default value is 120 seconds.  permalink

3. format, indicates whether the return is in XML or JSON. The default is XML. permalink

4. seed, a string returned from a previous call to the hose, passed back to the next call. If any new items came in while you were processing the the previous call, or if your client rebooted or otherwise went away for a long time, passing back the seed assures that you don't miss any news. If you don't mind possibly missing some news you don't have to specify the seed.  permalink

None of the parameters are case-sensitive. In other words, JSON is the same as json is the same as JsOn. permalink

The values returned are straight from RSS 2.0. elements like title, link, description, pubDate, etc. There are three additional values that are passed back, the feedUrl, feedTitle and feedLink of the feed the item came from. Hoses can be made up of many feeds, and it's sometimes useful to know which feed an item came from.  permalink

There are two other entry-points: permalink

1. recent, which just returns the latest stories. It's useful to see what you get back from the feednose while you're developing, or to show someone roughly what the hose looks like at a technical level. It looks for several optional parameters, as described above: name and format that determine which hose is queried and what format the returned text is in. There's an additional optional parameter, count. If not specified it's 3. The maximum count is 15.  permalink

2. seed, which returns the current seed without waiting and without returning any news. You can specify the name and format, as optional parameters, as described above. permalink

RSS feed for Scripting News
This site contributes to the scripting.com community river.


© Copyright 1997-2012 Dave Winer. Last update: Thursday, December 02, 2010 at 3:31 AM Eastern. Last build: 8/26/2012; 6:01:54 PM. "It's even worse than it appears."

RSS feed for Scripting News

Previous / Next