NetTalk Central

Author Topic: Anyone done an RSS feed?  (Read 15408 times)

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Anyone done an RSS feed?
« on: August 21, 2008, 05:27:25 PM »
I have a client asking about the possibility of adding an RSS feed to my app so that when a new record is added it sends a notice to anyone who has subscribed to the feed. I wondered if someone has looked into this who might do a sanity check of my approach:

When a user saves a record, I'm simply going to write the record's info out to a XML file that will be somewhere under the web directory (NetTalk Web). This file will have an XML extension and this is the file that a reader will subscribe to. I'm going to add to the file from the top (newest records). I'm also going to trim the file from the bottom to limit the records somewhat.

The item will be as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.3.3" -->
<rss version="2.0"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:media="http://search.yahoo.com/mrss/">

<channel>
   <title>CustomerSiteName</title>
   <link>http://www.customersite.com?cat=-22</link>
   <language>en</language>

<item>
      <link>http://www.customersite.com/?p=158463</link>
      <title>New radio antenna product announced</title>
      <pubDate>Fri, 22 Aug 2008 02:57:12 +0000</pubDate>
         </item>
... more items here...

</channel>
</rss>

Anyone see any problems with this approach or any suggestions for optimizing the file production? One thing I'm a little worried about is if the file gets locked while trying to do an update or someone is trying to read it.

I need to dig into the x-files template too.
« Last Edit: August 21, 2008, 08:51:46 PM by Mike Grigsby »
Mike Grigsby
Credify Systems
Central Oregon, USA

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Anyone done an RSS feed?
« Reply #1 on: August 21, 2008, 10:08:20 PM »
Hi Mike,

Yep, that's pretty much all there is to it.

Incidentally you don't mention how often records will be changed, and this would determine how often a user sets his RSS reader to Poll. What you don't want is some RSS reader (or worse yet 100 of them) polling every minute. Unless bandwidth is very cheap for you.

xFiles has some docs on making RSS-style XML files. Which means you can turn a file (like an In-Memory file for example) into an RSS XML file with 1 line of code. (well may be a handful depending on what you want.) It's a lot easier to manipulate the length etc of the IM table so this is the approach I'd take.

Cheers
Bruce

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11183
    • View Profile
Re: Anyone done an RSS feed?
« Reply #2 on: August 21, 2008, 10:11:52 PM »
Oh, and of course, what I didn't say is that there's no need for you to actually save the XML file. You could generate it, and send it from memory every time it is requested.

This would allow for some really interesting things. For example, say you had a software release RSS feed. So when you add something to this all the RSS readers alert their users, and the program is downloaded. By generating the XML file on the fly, you could "stagger" the information release.

For example, if 5 people are already downloading the release, then don't the release in any RSS requests. When the downloads are complete, then go back to announcing the release. In this way the "notification of the release" is balanced against the people downloading it, thus not overloading your server all in one go.

cheers
Bruce

Mike Grigsby

  • Sr. Member
  • ****
  • Posts: 380
    • Yahoo Instant Messenger - onthedotsoftware
    • View Profile
    • MyHomeAssets! Software (among others)
Re: Anyone done an RSS feed?
« Reply #3 on: August 22, 2008, 06:48:06 AM »
Interesting ideas Bruce, thanks for the input. It's actually for my HR system right now, and a blog I'll be putting online. So a visitor to my customer's program site could subscribe to a feed of new jobs. Having looked at the x-Files example last night, I think the route I'm going to take is to set up an RSS file. So when a new job requisition is added, it will also add it to the RSS file "queue".

The user can determine how many entries the file will hold, and how often the x-files procedure will generate the XML file. It could be after every save of a new job. The RSS field names will probably be the names an RSS reader would use, like item, title, description, link, etc. The link will be a link to the requisition, like

"http://jobboardsite.com/view_req?&REQ__ID=102001&View_btn=View&"
Mike Grigsby
Credify Systems
Central Oregon, USA