XEP-xxxx: File Sharing Notifications

Abstract
This specification provides a notification protocol for information about ongoing file uploads and media creation by the user.
Author
Linus Jahn
Copyright
© 1999 – 2020 XMPP Standards Foundation. SEE LEGAL NOTICES.
Status

ProtoXEP

WARNING: This document has not yet been accepted for consideration or approved in any official manner by the XMPP Standards Foundation, and this document is not yet an XMPP Extension Protocol (XEP). If this document is accepted as a XEP by the XMPP Council, it will be published at <http://xmpp.org/extensions/> and announced on the <standards@xmpp.org> mailing list.
Type
Standards Track
Version
0.0.4 (2018-08-21)
Document Lifecycle
  1. Experimental
  2. Proposed
  3. Draft
  4. Final

1. Introduction

The specification of Chat State Notifications (XEP-0085) [1] defines a protocol for exchanging information about the activity of the user, for example that the user is currently typing. However with the new possibilities of media sharing as in Stateless Inline Media Sharing (XEP-0385) [2] and HTTP File Upload (XEP-0363) [3] there are also new desirable chat states. For example when a user uploads an image, the upload usually takes a while. To notify the chat partner about the uploading process a new chat state is required.

When users send large files or have a very slow upstream connection it can make the chat partner confused when they are receiving an uploading state for a long time. In these cases it can be nice to share the upload progress. This way the chat partner can estimate if a file will arrive immediately or if it is better to go and get a coffee first.

Apart from notifications for sending files, there should also be notifications when a user is creating new media files, for example when the user is recording audio, recording a video or is taking a picture.

2. Requirements

3. Use Cases

3.1 User takes a picture via. the client and sends it afterwards

Example 1. User begins to take a picture
<message
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit'
    type='chat'>
  <creating xmlns='urn:xmpp:fsn:0' type='image' />
</message>

Bernardo is informing Francisco about his activity of taking a picture to send it afterwards. If Francisco's client supports file sharing notifications, it should display this similarly to 'Bernardo is taking a photo…'.

A list of possible 'type' attributes is defined below.

Table 1: Media types for <creating/> and <uploading/> states
Type Definition
animation An animated image file, for example a GIF file. It SHOULD NOT be used in the <creating/> state.
audio An audio file. This MAY also be displayed as a voice recording when used in the <creating/> state.
image An image file.
video A video file.
Example 2. User is now sending the image
<message
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit'
    type='chat'>
  <uploading xmlns='urn:xmpp:fsn:0' type='image' progress='0.28' />
</message>

Bernardo has taken a good picture for sending and has started uploading, now. The same notification is also used when the image existed before and there were no process of creating it.

The client SHOULD include a 'progress' attribute. It MUST be in the range of zero (0) and one (1). This value represents the bytes already sent divided by the total bytes. Generally it is not necessary to include more than two digits after the decimal point since the exact uploading status is not important. Clients MUST NOT send progress updates more often than once per second.

The 'type' attribute equals the 'type' attribute by the <creating/> element.

Example 3. User has finished the file upload
<message
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit'
    type='chat'>
  <upload-finished xmlns='urn:xmpp:fsn:0'>
</message>

The file upload has succeeded. Now Bernardo can send the file sharing message as in Stateless Inline Media Sharing (XEP-0385) [2] or another file sharing protocol. Francisco's client MUST clear the previous <uploading> notification. The <upload-finished/> notification itself SHOULD NOT be displayed to the user.

Example 4. User aborts the file upload
<message
    from='bernardo@shakespeare.lit/pda'
    to='francisco@shakespeare.lit'
    type='chat'>
  <upload-aborted xmlns='urn:xmpp:fsn:0' type='image' />
</message>

Of course the file upload also could have ended otherwise. In this case Bernardo has manually aborted the file upload. If the client encounters problems with the upload service after sending the first file sharing notification, the same format will also be used.

4. Business Rules

4.1 Chat State Notifications related rules

When a sending client chooses to map file sharing notifcations to Chat State Notifications (XEP-0085) [1], it MUST follow the following rules:

A client MAY choose not to apply this mapping if it allows text input while creating or uploading media, to allow transmitting normal XEP-0085 states for the text input.

If a client allows a user to pick media which are already created (thus skipping the <creating/> state), it MAY treat interaction with the media selection like text input in XEP-0085 (i.e. send <composing/> while the user is actively engaging with it and switch to <paused/> if inactive for a certain time).

4.2 Concurrent Uploads

Media sharing protocols as Stateless Inline Media Sharing (XEP-0385) [2] don't forbid concurrent file uploads, so it may be the case that a client is uploading multiple files of different types to the same user or groupchat at the same time. This could result in different file types being affected at the same time. In this case clients SHOULD follow these rules:

4.3 Client State Indication related rules

Servers supporting Client State Indication (XEP-0352) [4] SHOULD discard messages containing only a file sharing notification as long as a client is inactive.

4.4 Usage in groupchats

File sharing notifications MAY be used in groupchats as defined in Multi-User Chat (XEP-0045) [5] or Mediated Information eXchange (MIX) (XEP-0369) [6] just as in normal chats.

5. Implementation Notes

It is possible that the connection to any client is lost at any time or a client crashes. Thus, a client SHOULD work with timeouts that will clear notifications after certain intervals.

6. Security Considerations

A client MUST have a possibility to disable file sharing notifications. This setting MAY be the same as the one for enabling Chat State Notifications (XEP-0085) [1].

7. IANA Considerations

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

8. XMPP Registrar Considerations

8.1 Protocol Namespaces

This specification defines the following XML namespace:

Upon advancement of this specification from a status of Experimental to a status of Draft, the XMPP Registrar [7] shall add the foregoing namespace to the registry located at <https://xmpp.org/registrar/namespaces.html>, as described in Section 4 of XMPP Registrar Function (XEP-0053) [8].

9. XML Schema

tbd

10. Acknowledgements

Thanks to Jonas Wielicki for his helpful feedback and input.


Appendices

Appendix A: Document Information

Series
XEP
Number
xxxx
Publisher
XMPP Standards Foundation
Status
ProtoXEP
Type
Standards Track
Version
0.0.4
Last Updated
2018-08-21
Approving Body
XMPP Council
Dependencies
XMPP Core, XMPP IM
Supersedes
None
Superseded By
None
Short Name
NOT_YET_ASSIGNED

This document in other formats: XML  PDF

Appendix B: Author Information

Linus Jahn
Email
lnj@kaidan.im
JabberID
lnj@kaidan.im

Copyright

This XMPP Extension Protocol is copyright © 1999 – 2020 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 <http://xmpp.org/about/discuss.shtml> 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-0085: Chat State Notifications <https://xmpp.org/extensions/xep-0085.html>.

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

3. XEP-0363: HTTP File Upload <https://xmpp.org/extensions/xep-0363.html>.

4. XEP-0352: Client State Indication <https://xmpp.org/extensions/xep-0352.html>.

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

6. XEP-0369: Mediated Information eXchange (MIX) <https://xmpp.org/extensions/xep-0369.html>.

7. The XMPP Registrar maintains a list of reserved protocol namespaces as well as registries of parameters used in the context of XMPP extension protocols approved by the XMPP Standards Foundation. For further information, see <https://xmpp.org/registrar/>.

8. XEP-0053: XMPP Registrar Function <https://xmpp.org/extensions/xep-0053.html>.

Appendix H: Revision History

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

  1. Version 0.0.4 (2018-08-21)

    Add upload-finished state, minor improvements.

    lnj
  2. Version 0.0.3 (2018-07-20)

    Added Requirements and Acknowledgements, simplified some definitions and added rules for CSI.

    lnj
  3. Version 0.0.2 (2018-07-19)

    Seperated parts about the usage of chat states and moved the definitions of types to their examples.

    lnj
  4. Version 0.0.1 (2018-07-17)

    First draft.

    lnj

END