RFC 5264

Publication of Partial Presence Information

๐Ÿ“… published September 2008, from ietf

RFC 5264: Publication of Partial Presence Information ๐ŸŽ€

okay bestie, RFC 5264 is giving Standards Track energy โœจ It came out in September 2008 from the Network Working Group, and the authors are A. Niemi and M. Lonnfors (both from Nokia) plus E. Leppanen (listed as Individual) ๐Ÿ’œ The title block doesn't list anything it obsoletes or updates, so it's standing on its own ๐Ÿ’…


Status of This Memo ๐Ÿ“œ

ok so this doc specifies an Internet standards track protocol for the Internet community, and it's asking for discussion and suggestions for improvements ๐Ÿฆ‹ If you want the current standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐ŸŒธ And distribution of this memo is unlimited, so share it with everyone ๐ŸŒˆ

Abstract โœจ

so the Session Initiation Protocol (SIP) Extension for Event State Publication describes how a presence user agent can publish presence info to a presence agent ๐Ÿ’– The catch is that, using the Presence Information Data Format (PIDF), every publication carries the full state, even when only a tiny bit changed since last time ๐Ÿ™ˆ That makes updating a big presence document with small tweaks really heavy and inefficient ๐Ÿ˜ญ It hits hardest on low bandwidth and high latency links, where it can be a real burden on the system ๐Ÿ’€ This memo fixes that by introducing a way to publish partial presence information, which cuts the overhead and makes transport way more efficient ๐Ÿ‘‘

Table of Contents ๐Ÿงš

   1. Introduction ....................................................2
   2. Definitions and Document Conventions ............................3
   3. Overall Operation ...............................................3
      3.1. Presence Publication .......................................3
      3.2. Partial Presence Publication ...............................4
   4. Client and Server Operation .....................................5
      4.1. Content-Type for Partial Publications ......................5
      4.2. Generation of Partial Publications .........................5
      4.3. Processing of Partial Publications .........................7
           4.3.1. Processing <pidf-full> ..............................7
           4.3.2. Processing <pidf-diff> ..............................7
   5. Security Considerations .........................................8
   6. Examples ........................................................8
   7. Acknowledgements ...............................................12
   8. References .....................................................12
      8.1. Normative References ......................................12
      8.2. Informative References ....................................13

1. Introduction ๐ŸŒธ

okay so the SIP Extension for Event State Publication [RFC3903] lets Presence User Agents ('PUA') publish presence info about a user ('presentity') ๐Ÿ’… Then the Presence Agent (PA) gathers those publications from one or several presence user agents and builds the composite event state of the presentity โœจ

The baseline format for presence info is the Presence Information Data Format (PIDF) [RFC3863], and it's the default for presence publication ๐ŸŽ€ PIDF uses Extensible Markup Language (XML) [W3C.REC-xml] and groups data into elements called tuples ๐Ÿฆ‹ On top of that, [RFC4479], [RFC4480], [RFC4481], [RFC4482], and [RFC5196] define extension elements that add extra features to PIDF ๐ŸŒˆ

Here's the tea ๐Ÿซ– By default, presence publication uses the PIDF document format, and every publication carries full state, even if only a little of the info changed since the previous update ๐Ÿ˜ญ So updating a sizeable presence document, especially with small changes, has a big overhead and is pretty inefficient. And publishing over low bandwidth and high latency links makes that inefficiency even worse ๐Ÿ’€

This memo specifies a mechanism where, after an initial full state publication, the PUA can publish only those parts of the presence document that have changed since the previous update ๐Ÿ’– It does this with the partial PIDF [RFC5262] document format, which communicates a set of presence document changes to the PA. The PA then applies those changes in sequence to its own version of the presence document ๐Ÿ‘‘

Quick map of the doc, bestie ๐Ÿ—บ๏ธ Section 3 gives an overview of the partial publication mechanism, Section 4 has the detailed specification, Section 5 covers security considerations, and Section 6 has examples of partial publication ๐Ÿงš

2. Definitions and Document Conventions ๐Ÿ’œ

In this document, the key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" are to be interpreted as described in RFC 2119, BCP 14 [RFC2119], and indicate requirement levels for compliant implementations ๐Ÿ”ฅ

This doc also uses the vocabulary from the Model for Presence and Instant Messaging [RFC2778], the Event State Publication Extension to SIP [RFC3903], and the PIDF Extension for Partial Presence [RFC5262] ๐ŸŽ€

3. Overall Operation ๐Ÿฆ‹

this section is the baseline intro: basic presence publication plus an overview of the partial publication mechanism ๐ŸŒธ It's informational, so it doesn't have any normative statements. The rules live in Section 4 โœจ

3.1. Presence Publication ๐Ÿ’…

Event State Publication is specified in [RFC3903] ๐ŸŒˆ

So presence publication goes like this: a presence user agent sends a SIP PUBLISH request [RFC3903] aimed at the address-of-record of the presentity, and a presence agent or compositor handles it ๐Ÿ’– The body of that PUBLISH request carries the full event state as a presence document ๐Ÿซถ

The compositor processes the PUBLISH request and stores the presence info ๐Ÿงš It also assigns an entity-tag that identifies the publication, and it sends that entity-tag back to the PUA in the response to the PUBLISH request ๐Ÿ‘‘

Then the PUA uses that entity-tag in its next PUBLISH request to say which publication the request is meant to refresh, modify, or remove ๐Ÿฆ‹ Presence info starts as an initial publication and gets kept alive with refreshing and modifying publications ๐ŸŒˆ And it disappears either when it's explicitly removed or when it hits its expiration time ๐Ÿ’€

3.2. Partial Presence Publication ๐ŸŒธ

The partial publication mechanism lets the PUA update just the parts of its presence info that changed, meaning only the sections of the presence document that are different now โœจ The initial publication always carries full state ๐Ÿ’œ But successive modifying publications can carry state deltas instead, which means one or more changes since the previous update ๐ŸŽ€

Versioning these partial publications is necessary so the changes get applied in the right order ๐Ÿ’– The PUBLISH method [RFC3903] already handles this with entity-tags and conditional requests, which guarantee correct ordering of publication updates ๐Ÿ”ฅ

Note that the partial PIDF format [RFC5262] has a 'version' attribute that could also be used for versioning. We chose NOT to add a second versioning mechanism for partial publish, because it would only add ambiguity and a potentially undefined error case if the two mechanisms ever contradicted each other ๐Ÿ™ˆ

Here's how it starts ๐Ÿงš The PUA first publishes a full state initial publication ๐ŸŒˆ After that, the modifying publications can carry either state deltas or full state ๐Ÿฆ‹ Both the initial and modifying partial presence publications use the application/pidf-diff+xml content type [RFC5262] ๐Ÿ’… The initial one uses the <pidf-full> root element, and the modifying ones use either the <pidf-diff> or the <pidf-full> root element ๐Ÿ‘‘

Think of it this way ๐ŸŽ€ <pidf-full> wraps a regular PIDF document. <pidf-diff> can hold one or more operations: <add> elements for adding new elements or attributes, <replace> elements for replacing elements or attributes whose content changed, or <remove> elements to indicate that certain elements or attributes are removed โœจ The PUA gets to decide how granular its changes are when it tells the composer about them ๐Ÿ’– Sometimes there are so many changes that sending a full state publication is more efficient than sending a bunch of state deltas ๐Ÿ˜ญ

When the presence compositor gets a partial publication, it applies the included patch operations in sequence ๐Ÿซถ The resulting patched presence document then goes into the composition logic the same way a full state presence publication does ๐ŸŒธ Any changes to the publication expiration apply to the full, patched presence publication too ๐Ÿ”ฅ In other words, you can't roll back to an earlier version, except by submitting a full state publication ๐Ÿ™ˆ

4. Client and Server Operation ๐Ÿงš

Unless this document says otherwise, the presence user agent and presence agent behavior are as defined in [RFC3903] ๐Ÿ’œ

4.1. Content-Type for Partial Publications ๐Ÿฆ‹

The entities that support the partial publication extension described in this document MUST support the application/pidf-diff+xml content type defined in the partial PIDF format [RFC5262], in addition to the baseline application/pidf+xml content type defined in [RFC3863] ๐Ÿ‘‘

Listing the partial PIDF content type in the Accept header field of a SIP response is an explicit sign that the server supports the partial publication mechanism ๐Ÿ’– The PUA can learn about server support in two ways: through an explicit query, meaning a response to an OPTIONS request, or by trial-and-error, meaning after a 415 error response comes back to an attempted partial publication ๐ŸŒˆ

4.2. Generation of Partial Publications ๐Ÿ’…

okay so whenever a PUA decides to start publishing partial presence info ๐Ÿฆ‹, it first has to make an initial publication. This initial one always carries full state โœจ. After that, the presence info can get updated with modifying publications, and those can carry state deltas or full state too. Finally, the publication ends either by explicit removal or by expiration ๐Ÿซถ.

Both the initial and the modifying publications use the partial presence document format [RFC5262], and they all follow the normal rules for making publications from RFC 3903 [RFC3903], Section 4 ๐Ÿ’–.

If the initial PUBLISH request gets a 415 (Unsupported Media Type) back ๐Ÿ˜ญ, that means the compositor didn't understand the partial publication format. In that case, the PUA MUST follow the normal procedures for handling a 400-class response, as laid out in Section 8.1.3.5 of [RFC3261]. Specifically, the PUA SHOULD retry the publication with the default PIDF content type, which is application/pidf+xml ๐ŸŽ€. And if the PUA wants to know ahead of time whether a specific presence compositor supports partial presence publication, it MAY use the OPTIONS method, as described in [RFC3261] ๐Ÿงš.

To build a full-state publication, the PUA does this:

  • The Content-Type header field in the PUBLISH request MUST be set to application/pidf-diff+xml ๐Ÿ’œ.
  • The document in the body is populated with a <pidf-full> root element that has the entity attribute set to identify the presentity.
  • Under the <pidf-full> root element go all the children of a PIDF [RFC3863] <presence> element. This is the full state the PUA is aware of, and it MAY include elements from any extension namespace ๐ŸŒˆ.

To build a partial publication, you follow this process:

  • The Content-Type header field in the PUBLISH request MUST be set to application/pidf-diff+xml ๐Ÿ“.
  • The document in the body is populated with a <pidf-diff> root element that includes the entity attribute identifying the presentity.
  • Under the <pidf-diff> root element sits a set of patch operations that communicate the changes to the presentity's presence info. These operations MUST be constructed in sequence, as defined in the partial PIDF format [RFC5262] ๐Ÿ”ฅ.

The PUA is free to decide the granularity of how changes get communicated to the presence compositor. To reduce unnecessary network traffic, the PUA SHOULD batch several patch operations into a single PUBLISH request ๐ŸŒธ.

A reasonable granularity might be to batch state changes from related UI events into a single PUBLISH request. For example, when the user sets their status to "Away", freetext notes, service availability, and activities might all change as a result. ๐Ÿ™ˆ

If the size of the delta state becomes bigger than the size of the full state, the PUA SHOULD instead send a modifying publication carrying full state, unless that size comparison isn't possible.

To an implementation that generates state deltas straight out of its internal events, it may not be trivial to figure out the size of the corresponding full state ๐Ÿค“.

4.3. Processing of Partial Publications ๐Ÿ”ฅ

For each resource, the compositor keeps a record for each of the publications. These records are indexed using the entity-tag of the publications.

Processing generally follows the guidelines set in [RFC3903]. On top of that, PUBLISH requests that contain application/pidf-diff+xml need some extra processing, and that depends on whether the request has full or partial state ๐Ÿ‘‘.

4.3.1. Processing <pidf-full>

If the value of the Content-Type header field is application/pidf-diff+xml, and the document has a <pidf-full> root element, the publication contains full presence info, and the next step applies:

  • The compositor MUST take the received presence document under <pidf-full> as the local presence document, replacing any previous publications.

If any errors pop up before the entire publication is completely processed, the compositor MUST reject the request with a 500 (Server Internal Error) response, and revert back to its original, locally stored presence info ๐Ÿ’€.

4.3.2. Processing <pidf-diff>

If the value of the Content-Type header field is application/pidf-diff+xml, and the document in the body has a <pidf-diff> root element, the publication contains partial presence info (a state delta), and the next steps apply:

  • If the publication containing the <pidf-diff> root element is a modifying publication (i.e., it contains an If-Match header field with a valid entity-tag), the compositor MUST apply the included patch operations in sequence against its locally stored presence document.
  • Otherwise, the publication is an initial publication, and for those only <pidf-full> is allowed. So the publication MUST be rejected with an appropriate error response, such as a 400 (Invalid Partial Publication) ๐Ÿ™…โ€โ™€๏ธ.

If a publication carrying partial presence info expires without the PUA refreshing it, the compositor MUST clear the entire, full-state publication.

This means the compositor doesn't keep a record of the applied patches. So, unlike some versioning systems, it doesn't roll back to an earlier version if a particular partial publication expires ๐Ÿ”™.

If the compositor encounters errors while processing the application/pidf-diff+xml document, it MUST reject the request with a 400 (Bad Request) response. It MAY also include diagnostics information in the body of the response, using an appropriate error condition element defined in Section 5.1. of [RFC5261] ๐Ÿงพ.

If any other errors come up before the entire partial publication is completely processed, including all of the patch operations in the application/pidf-diff+xml body, the compositor MUST reject the request with a 500 (Server Internal Error) response, and revert back to its original, locally stored presence information โœจ.


5. Security Considerations ๐Ÿ”

this one is lowkey short but it's a whole vibe ๐Ÿ˜ค. This specification relies on protocol behavior defined in [RFC3903]. General security considerations related to Event State Publication are extensively discussed in that specification, and all the identified security considerations apply to this document in entirety. In addition, this specification adds no new security considerations. so the big security stuff lives over in RFC 3903, and all of it applies here too, no exceptions ๐Ÿซก๐Ÿ’….

6. Examples โœจ

okay so this section is the example that makes everything click ๐Ÿฆ‹ It shows a presence system using the partial publication mechanism, and honestly it's giving main character energy ๐Ÿ’…

First, the PUA sends an initial publication with the full state ๐Ÿ“ฎ The compositor replies with a 200 OK that carries an entity-tag. That entity-tag is basically the receipt that lets the PUA update the initial full state later with partial publications that only contain the deltas ๐Ÿงพโœจ

Then, at some point, the resource state changes. The PUA bundles those changes into a set of patch operations and sends a modifying publication ๐Ÿ”ง It uses the entity-tag to say which publication the patches should be applied against. The compositor applies the patch operations to its local presence document in sequence, then returns a 200 OK with a brand new entity-tag ๐ŸŽ€

Figure 1 is the whole flow at a glance ๐Ÿ‘€

                                         Presence Agent /
                 PUA                        Compositor
                  | (M1) PUBLISH                |
                  |---------------------------->|
                  | (M2) 200 OK                 |
                  |<----------------------------|
                  |                             |
                  |                             |
                  |                             |
                  | (M3) PUBLISH                |
                  |---------------------------->|
                  | (M4) 200 OK                 |
                  |<----------------------------|
                  |                             |
                 _|_                           _|_

            Figure 1: Partial Publication Message Flow

Now for the message details ๐Ÿ”

(M1): PUA -> Compositor

     PUBLISH sip:resource@example.com SIP/2.0
     ...
     Event: presence
     Expires: 3600
     Content-Type: application/pidf-diff+xml
     Content-Length: 1457

     <?xml version="1.0" encoding="UTF-8"?>
     <p:pidf-full xmlns="urn:ietf:params:xml:ns:pidf"
            xmlns:p="urn:ietf:params:xml:ns:pidf-diff"
            xmlns:r="urn:ietf:params:xml:ns:pidf:rpid"
            xmlns:c="urn:ietf:params:xml:ns:pidf:caps"
            entity="pres:someone@example.com">

      <tuple id="sg89ae">
       <status>
        <basic>open</basic>
        <r:relationship>assistant</r:relationship>
       </status>
       <c:servcaps>
        <c:audio>true</c:audio>
        <c:video>false</c:video>
        <c:message>true</c:message>
       </c:servcaps>
       <contact priority="0.8">tel:09012345678</contact>
      </tuple>
      <tuple id="cg231jcr">
       <status>
        <basic>open</basic>
       </status>
       <contact priority="1.0">im:pep@example.com</contact>
      </tuple>

      <tuple id="r1230d">
       <status>
        <basic>closed</basic>
        <r:activity>meeting</r:activity>
       </status>
       <r:homepage>http://example.com/~pep/</r:homepage>
       <r:icon>http://example.com/~pep/icon.gif</r:icon>
       <r:card>http://example.com/~pep/card.vcd</r:card>
       <contact priority="0.9">sip:pep@example.com</contact>
      </tuple>

      <note xml:lang="en">Full state presence document</note>
      <r:person>
       <r:status>
        <r:activities>
         <r:on-the-phone/>
         <r:busy/>
        </r:activities>
       </r:status>
      </r:person>

      <r:device id="urn:esn:600b40c7">
       <r:status>
        <c:devcaps>
         <c:mobility>
          <c:supported>
           <c:mobile/>
          </c:supported>
         </c:mobility>
        </c:devcaps>
       </r:status>
      </r:device>

     </p:pidf-full>

(M2): Compositor -> PUA

     SIP/2.0 200 OK
     ...
     SIP-ETag: 61763862389729
     Expires: 3600
     Content-Length: 0

(M3): PUA -> Compositor

     PUBLISH sip:resource@example.com SIP/2.0
     ...
     Event: presence
     SIP-If-Match: 61763862389729
     Expires: 3600
     Content-Type: application/pidf-diff+xml
     Content-Length: 778

     <?xml version="1.0" encoding="UTF-8"?>
     <p:pidf-diff xmlns="urn:ietf:params:xml:ns:pidf"
                  xmlns:p="urn:ietf:params:xml:ns:pidf-diff"
                  xmlns:r="urn:ietf:params:xml:ns:pidf:rpid"
                  entity="pres:someone@example.com">

      <p:add sel="presence/note" pos="before"><tuple id="ert4773">
       <status>
        <basic>open</basic>
       </status>
       <contact priority="0.4">mailto:pep@example.com</contact>
       <note xml:lang="en">This is a new tuple inserted
             between the last tuple and note element</note>
      </tuple>

      </p:add>
      <p:replace sel="*/tuple[@id='r1230d']/status/basic/text()"
       >open</p:replace>

      <p:remove sel="*/r:person/r:status/r:activities/r:busy"/>

      <p:replace sel="*/tuple[@id='cg231jcr']/contact/@priority"
       >0.7</p:replace>

     </p:pidf-diff>

(M4): Compositor -> PUA

     SIP/2.0 200 OK
     ...
     SIP-ETag: 18764920981476
     Expires: 3600
     Content-Length: 0

7. Acknowledgements ๐Ÿซถ

The authors want to give a huge shoutout to Atle Monrad, Christian Schmidt, George Foti, Fridy Sharon-Fridman, and Avshalom Houri for their review comments. You all are literally the best ๐ŸŒˆ

8. References ๐Ÿ“š

8.1. Normative References

[RFC2119]      Bradner, S., "Key words for use in RFCs to Indicate
               Requirement Levels", BCP 14, RFC 2119, March 1997.

[RFC3903]      Niemi, A., "Session Initiation Protocol (SIP)
               Extension for Event State Publication", RFC 3903,
               October 2004.

[RFC3863]      Sugano, H., Fujimoto, S., Klyne, G., Bateman, A.,
               Carr, W., and J. Peterson, "Presence Information Data
               Format (PIDF)", RFC 3863, August 2004.

[RFC3261]      Rosenberg, J., Schulzrinne, H., Camarillo, G.,
               Johnston, A., Peterson, J., Sparks, R., Handley, M.,
               and E. Schooler, "SIP: Session Initiation Protocol",
               RFC 3261, June 2002.

[RFC5262]      Lonnfors, M., Costa-Requena, J., Leppanen, E., and H.
               Khartabil, "Presence Information Data Format (PIDF)
               Extension for Partial Presence", RFC 5262, September
               2008.

[RFC5261]      Urpalainen, J., "An Extensible Markup Language (XML)
               Patch Operations Framework Utilizing XML Path Language
               (XPath) Selectors", RFC 5261, September 2008.

8.2. Informative References

[RFC2778]      Day, M., Rosenberg, J., and H. Sugano, "A Model for
               Presence and Instant Messaging", RFC 2778,
               February 2000.

[RFC4479]      Rosenberg, J., "A Data Model for Presence", RFC 4479,
               July 2006.

[RFC4480]      Schulzrinne, H., Gurbani, V., Kyzivat, P., and J.
               Rosenberg, "RPID: Rich Presence Extensions to the
               Presence Information Data Format (PIDF)", RFC 4480,
               July 2006.

[RFC4481]      Schulzrinne, H., "Timed Presence Extensions to the
               Presence Information Data Format (PIDF) to Indicate
               Status Information for Past and Future Time
               Intervals", RFC 4481, July 2006.

[RFC4482]      Schulzrinne, H., "CIPID: Contact Information for the
               Presence Information Data Format", RFC 4482,
               July 2006.

[RFC5196]      Lonnfors, M. and K. Kiss, "Session Initiation Protocol
               (SIP) User Agent Capability Extension to Presence
               Information Data Format (PIDF)", RFC 5196, September
               2008.

[W3C.REC-xml]  Bray, T., Paoli, J., Sperberg-McQueen, C., and E.
               Maler, "Extensible Markup Language (XML) 1.0 (2nd
               ed)", W3C REC-xml, October 2000,
               <http://www.w3.org/TR/REC-xml>.

Authors' Addresses ๐Ÿ–‹๏ธ

Aki Niemi
Nokia
P.O. Box 407
NOKIA GROUP, FIN 00045
Finland

Phone: +358 71 8008000
EMail: aki.niemi@nokia.com


Mikko Lonnfors
Nokia
Itamerenkatu 11-13
Helsinki
Finland

Phone: +358 71 8008000
EMail: mikko.lonnfors@nokia.com


Eva Leppanen
Individual
Lempaala
Finland

EMail: eva.leppanen@saunalahti.fi

Copyright (C) The IETF Trust (2008).

This document is subject to the rights, licenses and restrictions contained in BCP 78, and except as set forth therein, the authors retain all their rights.

This document and the information contained herein are provided on an "AS IS" basis and THE CONTRIBUTOR, THE ORGANIZATION HE/SHE REPRESENTS OR IS SPONSORED BY (IF ANY), THE INTERNET SOCIETY, THE IETF TRUST AND THE INTERNET ENGINEERING TASK FORCE DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Intellectual Property ๐Ÿ”

The IETF takes no position regarding the validity or scope of any Intellectual Property Rights or other rights that might be claimed to pertain to the implementation or use of the technology described in this document or the extent to which any license under such rights might or might not be available; nor does it represent that it has made any independent effort to identify any such rights. Information on the procedures with respect to rights in RFC documents can be found in BCP 78 and BCP 79.

Copies of IPR disclosures made to the IETF Secretariat and any assurances of licenses to be made available, or the result of an attempt made to obtain a general license or permission for the use of such proprietary rights by implementers or users of this specification can be obtained from the IETF on-line IPR repository at http://www.ietf.org/ipr.

The IETF invites any interested party to bring to its attention any copyrights, patents or patent applications, or other proprietary rights that may cover technology that may be required to implement this standard. Please address the information to the IETF at ietf-ipr@ietf.org.

๐Ÿ“ฆ where this page comes from