RFC 5264
Publication of Partial Presence Information
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 theentityattribute 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 theentityattribute 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 anIf-Matchheader 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
Full Copyright Statement โ๏ธ
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
- ietf: rfc5264 2008-09
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms