Supplement to the tutorials of Kang Ye PubSubHubbub

Source: Internet
Author: User

Zheng @ playpoly SR 20090924

KANG Ye posted two tutorials on getting started with pubsubhubbub, PubSubHubbub working principles and usage, and [tutorial] how to use the PubSubHubbub protocol. Here are some additional points:

1. About subscription expiration and automatic subscription Refresh:

The first Request "Subscriber Sends Subscriber Request" (Subscriber --> Hub) is a Subscriber Request, which is called the second Request "Hub Verifies Intent of the Subscriber" (Hub --> Subscriber) is Verification.

There is also a heartbeat strategy, that is, the Automatic subscribe Refresh. In this way, when your subscriber goes offline or goes down for a period of time, the hub does not need to push data to you.

1:
When a Verification request is initiated, the hub also sends a parameter:
Hub. lease_seconds = 3600
It indicates that the subscription will expire in an hour (subscribe expiry ).

2:
The value of hub. lease_seconds can be the value that the subscriber tells the hub at the first request subscription, or it can be determined by the hub itself.

3:
If hub. lease_seconds is not set in the subscribe Request, it indicates that the Subscription is intended permanently. The hub heartbeat policy is as follows:
Before the subscription expires, the hub will send a confirmation request to subscriber to confirm whether to subscribe again. In this validation request, all parameters are the same as those in the Verification request, except that the challenge code is new.

Therefore, subscriber does not need to deal with the Automatic subscribe Refreshing problem. Because the first is whether the hub initiates a request to continue the Subscription, and the second is to reply to the challenge code and 200 OK as usual to continue the Subscription.

 

Ii. Handling updated content:

For Subscriber subscribed to Google Reader Shared Items, when the content is updated, the hubStateless", So the hub will send all the data of the Shared Items Feed during the first subscription, usually eight data records.

Generally, it only sends the latest Shared article.Stateful.

The storage status of the Hub Server has a certain time limit.If a user has not shared an article for a long time, such as having gone to bed, then when he shares the article again the next day, the Hub will push all the data (8 entries. This indicates that within a period of time,For example, if the Hub caches the data status pushed to the Subscriber within one hour, it will be cleared after expiration.. Hub no longer remembers what data has been sent to you.

For example, the Request. content sent by a hub is:

<? Xml version = "1.0" encoding = "UTF-8"?>
<FeedXmlns = "http://www.w3.org/2005/Atom" xmlns: media = "http://search.yahoo.com/mrss/" xmlns: idx = "urn: atom-extension: indexing" idx: index = "no" xmlns: gr = "http://www.google.com/schemas/reader/atom/"> <generator uri = "http://www.google.com/reader"> Google Reader </generator> <id> tag: google.com, 2005: reader/user/15221435823542888940/state/com. google/broadcast </id> <link href = "http://pubsubhubbub.appspot.com/" rel = "hub"/> <title> zhengyun's shared items in Google Reader </title> <gr: continuation> CPbs2qqhq5wC </gr: continuation> <link href = "http://www.google.com/reader/public/atom/user%2F15221435823542888940%2Fstate%2Fcom.google%2Fbroadcast" rel = "self"/> <author> <name> zhengyun </name> </author> <updated>: 57Z </updated>
<EntryGr: crawl-timestamp-msec = "1253805777401"> <id gr: original-id = ""> tag: google.com, 2005: reader/item/adfecf99f68d6292 </id> <title type = "html"> happiness lesson: if you do not know what you really want to do, you can | happiness course _ spreading beneficial psychology </title> <published> 2009-09-24T15: 22: 57Z </published> <updated> 2009-09-24T15: 22: 57Z </updated> <link href = "http://www.xingfuke.net/psyblog/xingfuke1861.html" type = "text/html" rel = "alternate"/> <link href = "http://www.xingfuke.net/" r El = "related" title = "www.xingfuke.net"/> <content type = "html" xml: base = "http://www.xingfuke.net/psyblog/xingfuke1861.html"> if there is no direction or answer, so read 100 books and exercise well. These two things are always right and should always be done immediately. </Content> <author gr: unknown-author = "true"> <name> (author unknown) </name> </author> <source gr: stream-id = "user/15221435823542888940/source/com. google/link "> <id> tag: google.com, 2005: reader/user/15221435823542888940/source/com. google/link </id> <title type = "html"> www.xingfuke.net </title> <link href = "http://www.xingfuke.net/" type = "text/html" rel = "alternate" /> </source> </Entry>
</Feed>

Anyway, subscriber:

1:

When receiving data, it is best to process it asynchronously (resolution, storage, etc.). Ensure that the data is returned as soon as possible, especially when you receive the Shared Items Feed XML, in case the data size is too large.

2:

Although the Hub is in the statusMake sure that you are in a status and know which Items are newly released. After all, whether the Hub pushes only the latest articles to be shared depends on the frequency of sharing by Google Reader users..

3:

When you want to receive updates from hundreds of feeds, you can set different callback addresses for each Feed, for example:

For Shared Items of keso, the specified callback address is:

Http: // Server/subscribe/keso. In this way, when you receive the data, you do not need to parse the Feed XML content to know which Shared Items update this is.

 

3. When will the hub notify you of updates?

It is not as often imagined. As soon as you click the Shared button of an article in Google Reader, The hub immediately pushes updates to the subscriber.Not necessarily.

In most cases, the new data is pushed in a few seconds. However, sometimes it may be the hub policy setting. A hub push is triggered only after two shared clicks. The pushed data content is the two articles shared in this batch.

 

Zheng @ playpoly SR 20090924 Beijing Report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.