%ents; ]>
Simple JSON Messaging This specification proposes a simple mechanism by which applications can transfer data safely, without needing additional protocol design work. It is intended to provide a protocol that is trivial to implement and can be driven with a simple API. &LEGALNOTICE; 0432 Deferred Standards Track Standards Council XMPP Core XEP-0335 udt &dcridland; 0.1.1 2022-04-12 fs Declare missing dependency on XEP-0335. 0.1.0 2020-02-25 XEP Editor (jsc) Accepted by vote of Council on 2020-02-19. 0.0.2 2020-02-13 dwd

Have another crack at getting this through Council.

  • Rename to a more obvious name
  • Remove IQ
  • Remove API, instead describe API requirements
0.0.1 2019-12-30 dwd
  • Initial Revision

Applications written on top of XMPP often need to exchange data that has no existing standard. Such applications are often written by developers unfamiliar with best practise in designing new extensions for XMPP, making it hard to achieve this simple design goal without causing longer term problems.

This leads to "solutions" such as stuffing JSON directly in the <body/> element, for example, and recognising this at the receiver either by heuristics or by a special <subject/>. While this works, it is difficult to then migrate to something else, and enforces that custom clients are always used.

Therefore this document proposes a very simple (and simplistic) framework for sending such data which - while very light on features - nevertheless conforms to best practice, and yields an interoperable protocol. Unusually, this specification SHOULD NOT be used as a base upon which to build other standards.

Data transferred using this specification is encoded using JSON. The type of the data is given by a URI under the same rules as an XML namespace, and this specification refers to this as the datatype.

Because this document defines mechanisms for sending essentially arbitrary data, no real-world examples are given.

Instead, example namespaces are used within an XML namespace prefixed by &nsx;

Support for this protocol is advertised by the Service Discovery protocol defined in &xep0030; using a feature of &ns;.

Support for a particular datatype is given by concatenating the &ns; feature with a hash character ('#') and the datatype, for example &ns;#&nsx;foo.

Simple JSON Messaging payloads may also be placed within a <message/> stanza. <message/> stanzas MAY contain multiple UDT payloads, but typical usage is expected to be that there will be only one. The JSON Messaging payload may be ancillary data to another message, or a standalone message in its own right.

A Simple JSON Messaging payload consists of a single element, <payload/>, qualified by the XML namespace &ns;. It has a single, mandatory attribute of datatype, which MUST contain a string conformant to the requirements for XML namespaces (typically a URI under the control of the application developer).

As with XML namespaces, this URI is never expected to be resolved, and is used solely as an identifier. Different strings are considered entirely different datatypes, and common prefixes etc MUST be considered irrelevant for the purposes of interpreting the data. There are no common or standard datatypes.

The <payload element contains exactly one mandatory child element, the <json/> element defined in &xep0335;. This in turns contains the JSON data.

{ "annoying-teenager-level": 11 } ]]>

In order to satisfy the goals of this protocol, client library developers are encouraged to provide a simple to use API for this protocol. Developers are encouraged to use terms such as "JSON Message" in their API calls and documentation.

Support for a particular datatype SHOULD be advertised automatically when listening for custom messages of that type if possible.

]]>

All security implications herein are those of the payload.

This XEP requires no interaction with &IANA;.

None.

The authors wish to share any credit with many members of the community, including Florian Schmaus, Daniel Gultsch, Georg Lukas, and others.