ankurpiyush26 / pubsubhubbub

Automatically exported from code.google.com/p/pubsubhubbub
Other
1 stars 0 forks source link

Protocol: Specific content-type for Subscription Request? #148

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
SUMMARY:

The Subscription Request could (should?) have its own content-type, rather than 
the generic "application/x-www-form-urlencoded".

RELEVANT SECTION:  5.1

COMMENT/REQUEST:

I don't like XML any more than your average Python developer. But I'm beginning 
to really love REST (per Roy Fielding), so please take this suggestion as more 
of a RESTful suggestion than an XML suggestion. :)

If all (or most?) PubSubHubbub Subscription Requests are processed via web 
browser clients, then the "application/x-www-form-urlencoded" Content-Type 
makes sense, because most web browsers can't do custom Content-Type submission 
(at least, without a lot of help from Java or Javascript).

However, this protocol seems to be intended to enable non-browser clients, that 
is, other servers to submit Subscription Requests. Servers are much more 
capable at sending custom Content-Types in HTTP Requests.

It seems like we could gain a lot of semantic value by defining one (or more) 
specific Content-Type(s) for use by PubSubHubbub.

I just read through the Atom specification. Just by way of comparison, we could 
do something similar to that, and define an all-encompasing 
"application/pubsubhubbub+xml" Content-Type. If we had that, then it could 
include this sub-type for Subscriptions (Requests and Removals all in one REST 
Representation. 

Here's how the HTTP Conversation could work, to Subscribe:

POST /hub/
Host: hub.example.org
Accept: application/pubsubhubbub+xml;type=subscription
Content-Type: application/pubsubhubbub+xml;type=subscription
<?xml xmlns:push="http://www.w3.org/2014/PubSubHubbub">
<subscription
    callback="http://www.example.com/callmemaybe"
    topic="http://topics.example.org/cooltopic"
    lease_seconds="86400"
    secret="watermelon"
/>

201 Created
Content-Type: application/pubsubhubbub+xml;type=subscription
Location: http://hub.example.org/subscriptions/some-unique-identifier
...and we'd get back the REST Resource we just POSTed.

Then, when we want to unsubscribe, we simply DELETE that Subscription, like 
this:

DELETE /subscriptions/some-unique-identifier
Host: hub.example.org

200 OK
Content-Length: 0

Original issue reported on code.google.com by john.and...@cigna.com on 24 May 2014 at 12:55

GoogleCodeExporter commented 9 years ago
PubSubHubbub is now not tied to XML anymore. Going back there would probably be 
a step backward. 
Feel free to continue the discussion on 
https://github.com/pubsubhubbub/PubSubHubbub/issues?direction=desc&sort=created&
state=open

Original comment by julien.g...@gmail.com on 30 May 2014 at 4:09