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.3 (2024-10-17)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Stable
  4. Final

1. Introduction

WebXDC [1] 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 for the sandboxed web content. In order to provide support for WebXDC [1] widgets, the host protocol (XMPP in our case) must define a way to transmit these widgets and the associated state updates.

2. Glossary

This specification uses some terminology defined below:

3. 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) [3] or Stateless Inline Media Sharing (XEP-0385) [4]. The message MUST contain a <thread/> element with a new, unique id. Note: including multiple file-transfer mechanisms in the same message may be beneficial for broader compatibility.

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/webxdc+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>
  <x xmlns='jabber:x:oob'>
    <url>https://download.montague.lit/4a771ac1-f0b2-4a4a-9700-f2a26fa2bb67/calendar.xdc</url>
  </x>
</message>

4. Sending a State Update

When a widget needs to communicate an update to peers in a chat, this update may contain one or more of the following items as defined in WebXDC [5].

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 are delivered in a message which MUST have the same <thread> as the message which originally delivered the widget itself. The stanza SHOULD contain a x child having the urn:xmpp:webxdc:0 namespace, with these items (except for info) as children, as defined below.

4.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>

4.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>

4.3 The Payload Item

The payload item is delivered using JSON Containers (XEP-0335) [6] 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>

5. selfAddr

WebXDC [7] widgets get various data injected into them by the host application. One of these worth mentioning is the selfAddr property.

6. selfName

The selfName property defined by WebXDC [7] is human readable and may be set to anything useful per that specification. It MAY be set to the local Multi-User Chat (XEP-0045) [2] nickname or User Nickname (XEP-0172) [9] where relevant.

7. Accessibility Considerations

None

8. Security Considerations

It is assumed that an implementation of this XEP will be paired with an implementation of WebXDC [1]. Please see WebXDC [1] for sandboxing and security considerations for your WebXDC implementation.

This XEP does not introduce any specific security considerations besides those present in any WebXDC [1] implementation.

9. Privacy Considerations

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

10. IANA Considerations

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

11. XMPP Registrar Considerations

11.1 Protocol Namespaces

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

11.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.

12. 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>

13. 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.3
Last Updated
2024-10-17
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM, XEP-0335, XEP-0421, WebXDC
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. WebXDC docs: https://webxdc.org/docs/

2. XEP-0045: Multi-User Chat <https://xmpp.org/extensions/xep-0045.html>.

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

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

5. WebXDC sendUpdate: https://webxdc.org/docs/spec/sendUpdate.html

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

7. WebXDC selfAddr and selfName: https://webxdc.org/docs/spec/selfAddr_and_selfName.html

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

9. XEP-0172: User Nickname <https://xmpp.org/extensions/xep-0172.html>.

10. 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.3 (2024-10-17)
    spw
  2. Version 0.1.2 (2024-07-03)
    spw
  3. Version 0.1.0 (2024-06-20)
    XEP Editor: dg
  4. 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.3},
  institution = {XMPP Standards Foundation},
  url = {https://xmpp.org/extensions/xep-0491.html},
  date = {2024-06-05/2024-10-17},
}

END