Subscribe to an RSS Feed

主宰稳场 提交于 2019-12-03 15:06:51

The standard way is to poll. Not every x seconds but every x minutes or x hours.

The reasoning behind RSS is to keep the feed extremely simple. Small download and the same file can be served to all subscribers (easy to cache in memory and no processing overhead to find out exactly what and when to send to each client).

Not sure you quite understand the concept of RSS feeds.

It is simple:

  1. You application (RSS reader) sends an HTTP GET request to given RSS feed url.
  2. You get XML in return.
  3. You parse that XML and show that data on your UI.

And generally, the websites you mentioned are smart enough to identify DOS attacks (for example, frequent requests from same IP in very short time). So, you don't have to worry about that.

Also, while creating an RSS reader, every time you get new XML from feed url, you have to identify new posts from old ones (that you already have on your UI). Timestamps are generally used to identify posts, but, there no standard way of doing that.

RSS on a site / server does not manage any suscriptions. The suscription is only a concept in the RSS reader. That keeps stuff simple on the RSS server side, as there's no need for suscription management which made the protocol easy to adopt.

You have to periodically poll the RSS feed by an HTTP GET to the feed URL. You get a XML document in the RSS format in return. Then you parse it and display the infos you like. Voila.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!