RVP: Presence and Instant Messaging Protocol (2)

zhaozj2021-02-08  235

response

As a response to the success subscribe request for Pragma / Notify NOTINEPE, Presence Service returns a response code: 200 - Successful (success). The response header contains details on successful subscriptions, including the subscription-id header and the Subscription-Lifetime header, which may be different from the requested.

As a response to the successful subscribe request for Update / Propchange NOTINEPE, Presence Service returns a response code: 207 - Multi Status. The response header contains detailed information on success subscriptions, as described above. There may also have an XML body that contains the requested attribute current value.

When refreshing a rent, the success response from Presence Service will return a response code: 200 - Successful. Likewise, the response header contains detailed information about successful subscriptions, including the subscription-id header and the Subscription-Lifetime header, which may be different from the requested.

Example

The following example shows how to create a login subscription and an attribute subscription.

Login subscription

When a presentity is logged in, it can create a "local node" and an associated URL. For example, suppose Principal http://im.Acme.com/instmsg/aliases/maxb runs a Presentity on the machine 198.176.154.132. When Presentity logs in, it creates a local node http://198.176.154.132:1234. Suppose Principal is hosted by the server im.acme.com, and Presentity establishes login subscription to the node http://im.acme.com/instmsg/aliases/maxb, specifying the local node as a callback. The following example shows how to create such a login subscription.

>> request

Subscribe / Instmsg / AliaseS / Maxb HTTP / 1.1

SUBSCRIPTION-LIETIME: 14400

Notification-Type: Pragma / Notify

Call-back: http://198.176.154.132:1234

RVP-Notifications-Version: 0.2

Host: imHome1.acme.com

Content-Length: 0

Rvp-from-principal: http://im.acme.com/instmsg/aliases/maxb

>> Response

HTTP / 1.1 200 Successful

Subscription-ID: 98210

SUBSCRIPTION-LIETIME: 14400

RVP-Notifications-Version: 0.2

Property subscription

Principal in the previous example, a permanent login subscription to the node http://im.example.com/instmsg/aliases/deriks. The Call-Back header is the logic URL of the subscriber MaxB, allowing more protection. However, this does not mean that the MaxB needs to issue a Subscribe request to his logic node on im.acme.com to forward the attribute update. The following example shows how to create such an attribute subscription.

>> request

Subscribe http://im.example.com/instmsg/aliases/deriks http / 1.1

Subscription-Lifetime: 14400NOTIFICATION-TYPE: UPDATE / PROPCHANGE

Call-back: http://im.acme.com/instmsg/aliases/maxb

RVP-Notifications-Version: 0.2

Host: im.example.com

Content-Length: 0

Rvp-from-principal: http://im.acme.com/instmsg/aliases/maxb

>> Response

HTTP / 1.1 207 Multi-Status

Subscription-id: 79

SUBSCRIPTION-LIETIME: 14400

Content-Type: Text / XML

Content-Length: XXXX

RVP-Notifications-Version: 0.2

XMLns: r = "http://schemas.microsoft.com/rvp/">

Http://im.example.com/instmsg/aliases/deriks

Derik

deriks@example.com

0

http / 1.1.200.successful

Unsubscribe

UNSUBSCRIBE method, taken from GENA to delete subscriptions that use Subscribe requests. The subscription-id header is used to uniquely specify a subscription that should be canceled. Who can undo subscription is determined by Presence Service.

Example

The following example shows how Watcher issues a UNSUBSCRIBE request to prevent further updates from one stock from im.stockquotes.com.

>> request

Unsubscribe / stock / companya http / 1.1

Host: im.stockquotes.com

RVP-Notifications-Version: 0.2

Rvp-from-principal: http://im.acme.com/instmsg/aliases/maxb

Subscription-id: 1234

Content-Length: 0

>> Response

HTTP / 1.1 200 Successful

RVP-Notifications-Version: 0.2

Subscriptions

The new RVP Subscriptions method extracts the list of active subscriptions on the server node. Possible uses include: View the Watcher for distributing list members, or view the RVP Presentities for the Watcher list of the monitoring its online state. The request contains NOTINICATION-TYPE (Update / PropChange or PRAGMA / NOTIFY) of the subscription of the requester. This is the Notification-Type sent in the corresponding subscribe call to each subscription.

Answer to include a subscription list in the XML body. Each Subscriptions request contains the subscriber's subscription-id header, the subscriber's URL (if any) and the subscription remaining time (in seconds).

Subscriptions Requests Use the following new RVP XML elements: subscriptions, subscription, subscription-id, timeout, and rvp-print.

Example

The following example shows how to retrieve the subscription list and the remaining time of each subscription.

>> request

Subscriptions / Lists / Sales-Event HTTP / 1.1

Host: im.example.com

RVP-Notifications-Version: 0.2

Notification-Type: Update / PropChange

Rvp-from-principal: http://im.acme.com/instmsg/aliases/maxb

>> Response

HTTP / 1.1 200 Successful

RVP-Notifications-Version: 0.2

Content-Type: Text / XML

Content-Length: XXXX

XMLns: z = http://schemas.microsoft.com/rvp/

XMLns: a = http://schemas.microsoft.com/rvp/acl>

456

Http://im.example.com/instmsg/aliases/maxb

http://im.example.com/instmsg/aliase

S / maxb

4789

Http://im.example.com/instmsg/aliases/deriks

6656

Http://im.example.com/instmsg/aliases/deriks

8752

转载请注明原文地址:https://www.9cbs.com/read-1440.html

New Post(0)