XEP-0491: WebXDC

Abstract
This document defines an XMPP protocol extension to communicate WebXDC widgets and their state updates.
Author
Stephen Paul Weber
Copyright
© 2024 – 2024 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

Experimental

WARNING: This Standards-Track document is Experimental. Publication as an XMPP Extension Protocol does not imply approval of this proposal by the XMPP Standards Foundation. Implementation of the protocol described herein is encouraged in exploratory implementations, but production systems are advised to carefully consider whether it is appropriate to deploy implementations of this protocol before it advances to a status of Draft.
Type
Standards Track
Version
0.1.2 (2024-07-03)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

WebXDC is a specification for sharing interactive embeddable widgets built with web-like technologies (HTML, JavaScript) via a chat platform, and sharing state between participants in the chat without allowing external network connections. In order to use these, the host protocol must define a way to transmit the widgets and the associated state updates.

2. Sending a Widget in a Message

A widget may be attached to a message using any file-transfer mechanism supported by the client, such as Out-of-Band Data (XEP-0066) [1] or Stateless Inline Media Sharing (XEP-0385) [2]. The message MUST contain a <thread/> element with a new, unique id.

Example 1. An example of sending a widget
<message to='romeo@montague.lit' type='chat'>
  <thread>018fe972-ea89-7f4b-90f8-729b85b7f32d</thread>
  <media-sharing xmlns='urn:xmpp:sims:1'>
    <file xmlns='urn:xmpp:jingle:apps:file-transfer:5'>
      <media-type>application/xdc+zip</media-type>
      <name>Calendar</name>
      <size>3032449</size>
      <hash xmlns='urn:xmpp:hashes:2' algo='sha3-256'>2XarmwTlNxDAMkvymloX3S5+VbylNrJt/l5QyPa+YoU=</hash>
      <thumbnail xmlns='urn:xmpp:thumbs:1' uri='cid:sha1+ffd7c8d28e9c5e82afea41f97108c6b4@bob.xmpp.org' media-type='image/png' width='96' height='96'/>
    </file>
    <sources>
      <reference xmlns='urn:xmpp:reference:0' type='data' uri='https://download.montague.lit/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/calendar.xdc />
    </sources>
  </media-sharing>
</message>

3. Sending a State Update

When a widget needs to communicate an update to other participants, this update may contain the following information:

Table 1: Data transmitted with a WebXDC update
Item Description
info Human readable message to send to the chat
summary Text which may be shown next to the widget launcher
document Title which may be shown next to the widget launcher
payload Arbitrary JSON serializable value

These items, except for the info item, are delivered in a message which MUST have the same <thread> as the message which originally delivered the widget itself, as children of an element <x xmlns="urn:xmpp:webxdc:0"> as defined below.

3.1 The Info Item

The info item is human-readable and is not needed by the widget itself, thus it is appropriate to transmit it anywhere that it might be visible to all participants, such as in a message body. If this is the only item present, an empty <x> element SHOULD still be included in the message to signal this update came from the widget.

Example 2. An example of sending just info
<message to='romeo@montague.lit' type='chat'>
  <thread>018fe972-ea89-7f4b-90f8-729b85b7f32d</thread>
  <x xmlns='urn:xmpp:webxdc:0' />
  <body>Juliet has added an event.</body>
</message>

3.2 The Document and Summary Items

These items are delivered as children of the <x> item, and in the same namespace. The document item using a <document> child and the summary item using a <summary> child.

Example 3. An example of sending document and summary
<message to='romeo@montague.lit' type='chat'>
  <thread>018fe972-ea89-7f4b-90f8-729b85b7f32d</thread>
  <x xmlns='urn:xmpp:webxdc:0'>
    <document>Our Calendar</document>
    <summary>12 events</summary>
  </x>
</message>

3.3 The Payload Item

The payload item is delivered using JSON Containers (XEP-0335) [3] as a child of the <x> element

Example 4. An example of sending payload
<message to='romeo@montague.lit' type='chat'>
  <thread>018fe972-ea89-7f4b-90f8-729b85b7f32d</thread>
  <x xmlns='urn:xmpp:webxdc:0'>
    <json xmlns='urn:xmpp:json:0'>{}</json>
  </x>
</message>

4. selfAddr

WebXDC widgets get various data injected into them by the host application. One of these worth mentioning is the selfAddr property. When the chat is a 1:1 chat this property SHOULD be set to the XMPP URI for the local party's bare Jabber ID. When the chat supports Anonymous unique occupant identifiers for MUCs (XEP-0421) [4] this property SHOULD be set to the local party's occupant id.

5. Accessibility Considerations

None

6. Security Considerations

This XEP does not have any specific security considerations, however it is assumed that it will be paired with an implementation of WebXDC which requires very careful sandboxing.

7. Privacy Considerations

It should be clear to users that their actions inside an embedded widget may be transmitted to other participants.

8. IANA Considerations

This document requires no interaction with the Internet Assigned Numbers Authority (IANA) [5].

9. XMPP Registrar Considerations

9.1 Protocol Namespaces

This specification defines the following XML namespace: urn:xmpp:webxdc:0

9.2 Protocol Versioning

If the protocol defined in this specification undergoes a revision that is not fully backwards-compatible with an older version, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of XEP-0053.

10. XML Schema

<?xml version='1.0' encoding='UTF-8'?>

<xs:schema
    xmlns:xs='http://www.w3.org/2001/XMLSchema'
    targetNamespace='urn:xmpp:webxdc:0'
    xmlns='urn:xmpp:webxdc:0'
    xmlns:json='urn:xmpp:json:0'
    elementFormDefault='qualified'>

  <xs:annotation>
    <xs:documentation>
      The protocol documented by this schema is defined in
      XEP-0491: http://www.xmpp.org/extensions/xep-0491.html
    </xs:documentation>
  </xs:annotation>

  <xs:import namespace='urn:xmpp:json:0' schemaLocation='https://xmpp.org/schemas/json.xsd' />

  <xs:element name='x'>
    <xs:complexType>
      <xs:sequence>
        <xs:element name='summary' type='xsd:string' minOccurs='0' maxOccurs='1'/>
        <xs:element name='document' type='xsd:string' minOccurs='0' maxOccurs='1'/>
        <xs:element name='json' type='json:json' minOccurs='0' maxOccurs='1'/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>

11. Acknowledgements

Thanks to NLNet foundation for funding the work on this specification.


Appendices

Appendix A: Document Information

Series
XEP
Number
0491
Publisher
XMPP Standards Foundation
Status
Experimental
Type
Standards Track
Version
0.1.2
Last Updated
2024-07-03
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM
Supersedes
None
Superseded By
None
Short Name
webxdc
Source Control
HTML

This document in other formats: XML  PDF

Appendix B: Author Information

Stephen Paul Weber
Email
singpolyma@singpolyma.net
JabberID
singpolyma@singpolyma.net

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2024 by the XMPP Standards Foundation (XSF).

Permissions

Permission is hereby granted, free of charge, to any person obtaining a copy of this specification (the "Specification"), to make use of the Specification without restriction, including without limitation the rights to implement the Specification in a software program, deploy the Specification in a network service, and copy, modify, merge, publish, translate, distribute, sublicense, or sell copies of the Specification, and to permit persons to whom the Specification is furnished to do so, subject to the condition that the foregoing copyright notice and this permission notice shall be included in all copies or substantial portions of the Specification. Unless separate permission is granted, modified works that are redistributed shall not contain misleading information regarding the authors, title, number, or publisher of the Specification, and shall not claim endorsement of the modified works by the authors, any organization or project to which the authors belong, or the XMPP Standards Foundation.

Disclaimer of Warranty

## NOTE WELL: This Specification is provided on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. ##

Limitation of Liability

In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall the XMPP Standards Foundation or any author of this Specification be liable for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising from, out of, or in connection with the Specification or the implementation, deployment, or other use of the Specification (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if the XMPP Standards Foundation or such author has been advised of the possibility of such damages.

IPR Conformance

This XMPP Extension Protocol has been contributed in full conformance with the XSF's Intellectual Property Rights Policy (a copy of which can be found at <https://xmpp.org/about/xsf/ipr-policy> or obtained by writing to XMPP Standards Foundation, P.O. Box 787, Parker, CO 80134 USA).

Visual Presentation

The HTML representation (you are looking at) is maintained by the XSF. It is based on the YAML CSS Framework, which is licensed under the terms of the CC-BY-SA 2.0 license.

Appendix D: Relation to XMPP

The Extensible Messaging and Presence Protocol (XMPP) is defined in the XMPP Core (RFC 6120) and XMPP IM (RFC 6121) specifications contributed by the XMPP Standards Foundation to the Internet Standards Process, which is managed by the Internet Engineering Task Force in accordance with RFC 2026. Any protocol defined in this document has been developed outside the Internet Standards Process and is to be understood as an extension to XMPP rather than as an evolution, development, or modification of XMPP itself.

Appendix E: Discussion Venue

The primary venue for discussion of XMPP Extension Protocols is the <standards@xmpp.org> discussion list.

Discussion on other xmpp.org discussion lists might also be appropriate; see <https://xmpp.org/community/> for a complete list.

Errata can be sent to <editor@xmpp.org>.

Appendix F: Requirements Conformance

The following requirements keywords as used in this document are to be interpreted as described in RFC 2119: "MUST", "SHALL", "REQUIRED"; "MUST NOT", "SHALL NOT"; "SHOULD", "RECOMMENDED"; "SHOULD NOT", "NOT RECOMMENDED"; "MAY", "OPTIONAL".

Appendix G: Notes

1. XEP-0066: Out of Band Data <https://xmpp.org/extensions/xep-0066.html>.

2. XEP-0385: Stateless Inline Media Sharing (SIMS) <https://xmpp.org/extensions/xep-0385.html>.

3. XEP-0335: JSON Containers <https://xmpp.org/extensions/xep-0335.html>.

4. XEP-0421: Anonymous unique occupant identifiers for MUCs <https://xmpp.org/extensions/xep-0421.html>.

5. The Internet Assigned Numbers Authority (IANA) is the central coordinator for the assignment of unique parameter values for Internet protocols, such as port numbers and URI schemes. For further information, see <http://www.iana.org/>.

Appendix H: Revision History

Note: Older versions of this specification might be available at https://xmpp.org/extensions/attic/

  1. Version 0.1.2 (2024-07-03)
    spw
  2. Version 0.1.0 (2024-06-20)
    XEP Editor: dg
  3. Version 0.0.1 (2024-06-05)

    Initial version.

    spw

Appendix I: Bib(La)TeX Entry

@report{weber2024webxdc,
  title = {WebXDC},
  author = {Weber, Stephen Paul},
  type = {XEP},
  number = {0491},
  version = {0.1.2},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0491.html},
  date = {2024-06-05/2024-07-03},
}

END