<abstract>This documents defines an XMPP protocol extension for publishing the availability of a particular Stream Initiation request, such as a file.</abstract>
<p>&xep0095; defines a protocol to initiate a data stream between two Jabber/XMPP entities (e.g., for the purpose of &xep0096;). However, the sender is still responsible for informing potential receivers about the existence of a given stream. This JEP provides an automated way for a sender to announce the availability of a stream without initiating the data transfer. The purpose is to provide a "pull" protocol that enables a receiver to then request initiation of the stream from the sender.</p>
<p>A stream owner uses the <sipub/> element to announce that it can perform a specific SI request. This element can be sent to a publish-subscribe (XEP-0060) node, or sent directly to potential recipients within a &MESSAGE; stanza.</p>
<p>This format is nearly identical to that for the stream initiation <si/> element (see <cite>XEP-0095</cite>). The major difference is the lack of the feature negotiation for the stream methods, and the addition of a 'from' attribute.</p>
<p>The 'from' attribute SHOULD be present, and MUST be present if the stanza containing the <sipub/> is not from the stream owner (e.g., if the stream is advertised at a publish-subscribe node). If present, this attribute MUST be the valid JID for the stream owner.</p>
<p>The 'id' attribute is an opaque identifier. This attribute MUST be present, and MUST be a valid non-empty string. It uniquely identifies the published request at the potential sender.</p>
<p>As with stream initiation, the 'profile' attribute MUST be present, and MUST be the namespace URI governing the profile information. It identifies the format for the SI profile.</p>
<p>As with stream initiation, the 'mime-type' attribute SHOULD be present, and MUST be an IANA-registered content type. <note>The IANA registry of content types is located at <<linkurl='http://www.iana.org/assignments/media-types/'>http://www.iana.org/assignments/media-types/</link>>.</note> It provides the receiver with additional information about what the data stream will be.</p>
<p>The <sipub/> element MUST contain an element qualified by the namespace specified by the 'profile' attribute (e.g., <file xmlns='http://jabber.org/protocol/si/profile/file-transfer'/> for file transfer). This is the additional information about the data stream.</p>
<p>The <sipub/> information is typically provided via pubsub:</p>
<examplecaption='Sender advertises stream via publish-subscribe'><![CDATA[
<p>The <sipub/> element MAY also be included directly within a &MESSAGE; stanza sent to another entity (or multiple entities, e.g., in &xep0045; or via &xep0033;). This can be especially useful for informing an offline entity about an available stream.</p>
<p>One of the goals of sipub is to integrate <cite>Stream Initiation</cite> with <cite>Data Forms</cite> to provide a "file upload" capability. This is accomplished via the datatypes specified in &xep0122;. Each datatype is specific to the profile desired.</p>
<p>For example the datatype "sipub:file-transfer" is used to identify the file upload field(s) corresponding to <cite>XEP-0096</cite>:</p>
<p>When submitting such a form, a field's value(s) MUST be the <sipub/> identifier(s). Also, the submitter MUST provide an <sipub/> element within the data form for each file to be uploaded:</p>
<examplecaption='Submitting an "Upload File" form'><![CDATA[
<p>The form processor will use this to retrieve the file(s) to be uploaded.</p>
</section2>
<section2topic='Triggering the Stream Initiation Request'anchor='usecase.trigger'>
<p>A potential receiver starts the stream initiation session by sending an IQ-get to the sender, using the <start xmlns='http://jabber.org/protocol/sipub'/> element. This element contains the 'id' attribute to specify which published stream to retrieve:</p>
<examplecaption='Receiver requests start of stream'><![CDATA[
<iqtype='get'
id='sipub-request-0'
from='juliet@capulet.com/balcony'
to='romeo@montague.net/pda'>
<startxmlns='http://jabber.org/protocol/sipub'
id='publish-0123'/>
</iq>
]]></example>
<p>If the sender accepts the request, it responds with an IQ-result containing a <starting/> element. This element indicates the stream initiation identifier to be used:</p>
<examplecaption='Sender accepts request to start stream'><![CDATA[
<iqtype='result'
id='sipub-request-0'
from='romeo@montague.net/pda'
to='juliet@capulet.com/balcony'>
<startingxmlns='http://jabber.org/protocol/sipub'
sid='session-87651234'/>
</iq>
]]></example>
<p>Then the sender begins the stream initiation negotiation:</p>
<p>When publishing a stream via the <sipub/> element, the identifier SHOULD NOT be used as-is for the <si/> element, since a single publication will likely result in multiple <si/> requests, possibly from the same receiver.</p>
<p>Normally, each SI profile that wishes to be considered for use with Data Forms MUST register its own datatype qualified by the "sipub:" prefix. However, this JEP provides an initial seed, based on the currently accepted SI profiles. The following datatypes shall be registered for use with Data Forms Validation:</p>
<codecaption='Data Forms Validation Datatypes Registry Submission'><![CDATA[
<datatype>
<name>sipub:file-transfer</name>
<desc>Datatype for publishing an SI using the File Transfer Profile</desc>