HTTP Publish/Subscribe Communication Protocol
A communication protocol for distributing information related to a resource in substantially real-time to a subscriber includes a first HTTP request message for allowing the subscriber to request a subscription to the information related to the resource, where the first HTTP request message includes subscription data in a header and/or in a Uniform Resource Identifier (URI) reference associated with the first HTTP request message, and the subscription data identifies the first HTTP request message as a subscription request. The communication protocol also includes a second HTTP request message for allowing a publisher to update the information related to the resource, and an HTTP response message for allowing a publish/subscribe service to notify the subscriber of the updated information related to the resource each time the publish/subscribe service receives the second HTTP request message from the publisher.
1 . A method of subscribing to information related to a resource, the method comprising:
generating a first HTTP request message for requesting a subscription to information related to a resource, wherein the first HTTP request message includes subscription data in at least one of a header and a Uniform Resource Identifier (URI) reference associated with the first HTTP request message, wherein the subscription data identifies a tuple associated with the resource;
sending the HTTP request message to a publish/subscribe service to subscribe to the tuple associated with the resource; and
receiving an HTTP response message to the first HTTP request message including updated information related to the resource in response to the publish/subscribe service receiving a second HTTP request message updating the information related to the resource,
wherein at least one of the preceding actions is performed on at least one electronic hardware component.
2 . The method of claim 1 wherein the subscription data includes an indication of a duration of the subscription that comprises at least one of a specified time period and a specified number of HTTP response messages.
3 . The method of claim 1 further comprising receiving from the publish/subscribe service an HTTP message including a notification of an update to the information related to the resource, wherein the HTTP message is sent each time the publish/subscribe service receives another HTTP message that updates the information related to the resource.
4 . The method of claim 3 wherein the subscription data includes a subscription identifier that is associated with the HTTP request message.
5 . The method of claim 4 wherein each HTTP message is an HTTP response message that includes the subscription identifier associated with the HTTP request message such that each HTTP response message can be correlated to the HTTP request message.
6 . The method of claim 3 wherein the received HTTP message is an HTTP request message that includes either an HTTP PUT method or an HTTP POST method, the method further comprising:
providing an HTTP request handler component;
using the HTTP request handler component to generate an HTTP response message based on the subscription data associated with the received HTTP request message; and
passing the generated HTTP response message from the HTTP request message handler component to the subscriber.
7 . The method of claim 1 further comprising:
prior to sending the HTTP request message to the publish/subscribe service, establishing a persistent connection to the publish/subscribe service;
utilizing the persistent connection to send the HTTP request message to the publish/subscribe service; and
receiving from the publish/subscribe service via the persistent connection an HTTP message that notifies the subscriber of an update to the information related to the resource, wherein the HTTP message is sent each time the publish/subscribe service receives another HTTP message that updates the information related to the resource.
8 . The method of claim 7 further comprising:
providing a session layer on top of the persistent connection; and
creating a first session and a second session sharing the persistent connection, wherein at least one of the first session and the second session can be terminated without affecting the other session and the persistent connection.
9 . The method of claim 1 wherein the HTTP request message includes either an HTTP GET method or an HTTP HEAD method.
10 . A method of publishing information related to a resource to at least one subscriber via a publish/subscribe service, the method comprising:
receiving information related to a resource;
generating an HTTP request message including the information related to the resource and tuple information identifying a tuple associated with the resource; and
sending the HTTP request message to the publish/subscribe service, wherein the tuple associated resource is updated with the information related to the resource and in response to the tuple update an HTTP response message including the information is sent to a subscriber,
wherein at least one of the preceding actions is performed on at least one electronic hardware component.
11 . The method of claim 10 wherein the HTTP request message includes either an HTTP PUT method or an HTTP POST method.
12 . The method of claim 10 wherein generating the HTTP request message further comprises:
providing other data that identifies a non-subscribing recipient in at least one of a header and a Uniform Resource Identifier (URI) reference associated with the HTTP request message thereby allowing the publisher to distribute the updated information to the non-subscribing recipient.
13 . The method of claim 10 further comprising:
managing a roster and members of the roster via another HTTP request message.
14 . The method of claim 13 wherein managing the roster and members of the roster further comprises:
utilizing an HTTP request message including an HTTP PUT method to either add, update, or delete a roster or member; and
utilizing an HTTP request message including an HTTP GET method to retrieve a roster or member.
15 . A computer readable medium including a computer program for distributing information related to a resource between a publisher and a subscriber, the computer program comprising instructions executable in a publish/subscribe service for:
receiving information related to a resource;
generating an HTTP request message including the information related to the resource and tuple information identifying a tuple associated with the resource; and
sending the HTTP request message to the publish/subscribe service, wherein the tuple associated resource is updated with the information related to the resource and in response to the tuple update an HTTP response message including the information is sent to a subscriber.
16 . A computer readable medium including a computer program for subscribing to information related to a resource, the computer program comprising instructions executable in a subscriber for:
generating a first HTTP request message for requesting a subscription to information related to a resource, wherein the first HTTP request message includes subscription data in at least one of a header and a Uniform Resource Identifier (URI) reference associated with the first HTTP request message, wherein the subscription data identifies the first HTTP request message as a subscription request and identifies a tuple associated with the resource;
sending the HTTP request message to a publish/subscribe service to subscribe to the tuple associated with the resource; and
receiving an HTTP response message to the first HTTP request message including updated information related to the resource in response to the publish/subscribe service receiving a second HTTP request message updating the information related to the resource.