Experts in Real-Time Messaging and Push
  • Products
  • Solutions
  • Services
  • Shop
  • Customers
  • Company
  • Contact
  • Blog
  • French
  • P1PP logo

    Introduction: two possible use cases

    Pure XMPP, a geek approach

    Remark: Today, no XMPP client is supporting pubsub. You need to use an XML console of an XMPP client. Possible clients:

    Get an access to our ProcessOne Push Platform for any XMPP account registered on a federated XMPP server (S2S):

    • XMPP S2S connection
      • XMPP, BOSH and Websocket: xmpp://pubsub.p1pp.net:5269

    Or get a temporary anonymous C2S connection:

    • Anonymous XMPP C2S connection
      • XMPP: xmpp://p1pp.net:5222
      • BOSH: http://p1pp.net:5280/http-bind
      • Websocket: http://p1pp.net:5280/xmpp

    Give the name of the pubsub node to the subscriber.

    Web, a real-time web approach

    Remark: Enable push on a web page using P1PP platform. You need to download P1PP library for web, integrate it on the targeted web page. Automatically, the library, acting as a anonymous XMPP client, is subscribing to the pubsub node. No need for the end user, the subscriber, to know the name of the pubsub node.

    Getting Started

    This describes the basics of P1PP. For more in-depth information, check the documentation: P1PP Documentation

    There are two kinds of users that can interact with P1PP: publishers and subscribers. Any XMPP account registered into a federated XMPP server can use P1PP.

    • The publisher:
      • Create a new pubsub node
      • Publish information on the pubsub node
    • The subscriber:
      • Subscribe to an existing pubsub node
      • Automatically receives real time information published on the node (push)
    • The subscriber can also be any web page
    • The publisher:
      • Create a new pubsub node
        <iq type="set" to="pubsub.p1pp.net" id="create1">
          <pubsub xmlns="http://jabber.org/protocol/pubsub">
            <create node="mynode"/>
          </pubsub>
        </iq>
        				
        "mynode" can be any string identifying your node. You should receive a confirmation that the node has been created:
        <iq from="pubsub.p1pp.net" type="result" to="romeo@montague.lit/orchard" id="create1">
           <pubsub xmlns="http://jabber.org/protocol/pubsub">
             <create node="romeo@montague.lit/mynode"/>
           </pubsub>
        </iq>
        				
        Note that the node name has been prefixed by your bare JID. So, you have to provide that full node name (romeo@montague.lit/mynode) to other people interesting into subscribing to your node.
      • Publish information on a pubsub node
        <iq type="set" to="pubsub.p1pp.net" id="publish1">
           <pubsub xmlns="http://jabber.org/protocol/pubsub">
             <publish node="mynode">
               <item>
                 <mytag xmlns="mynamespace">
                mydata
                 </mytag>
               </item>
             </publish>
           </pubsub>
         </iq>
         				

    Only the owner (creator) of a node can publish data on it. You can put any piece of XML (the payload) into the item element, as long as it uses a specific XML namespace. Every people that have subscribed to this node will receive your XML payload into a message stanza.

    • The subscriber:
      • Subscribe to an existing pubsub node
        <iq type="set" to="pubsub.p1pp.net" id="sub1">
           <pubsub xmlns="http://jabber.org/protocol/pubsub">
             <subscribe node="romeo@montague.lit/mynode" jid="romeo@montague.lit"/>
           </pubsub>
        </iq>
        				
        The subscriber must know the full name of the pubsub node (romeo@montague.lit/mynode here). The jid attribute must be the JID of the subscriber. Some XMPP servers (like GTalk) block any incoming messages from contacts not in your roster. To bypass this limitation, send the following stanza:
        <presence type="subscribe" to="pubsub.p1pp.net"/>
        				
        Automatically receives real time information published on the node. Every time the publisher pushes something on a node, every subscriber receives a message containing the payload:
        <message from="pubsub.p1pp.net" to="romeo@montague.lit" type="headline">
          <event xmlns="http://jabber.org/protocol/pubsub#event">
            <items node="romeo@montague.lit/mynode">
              <item id="xxx">
                <mytag xmlns="mynamespace">
                mydata
                </mytag>
              </item>
            </items>
          </event>
          <addresses xmlns="http://jabber.org/protocol/address">
            <address type="replyto" jid="romeo@montague.lit/orchard"/>
          </addresses>
        </message>
        				
        The subscriber can also be any web page. Any web page can automatically subscribe to some nodes and receive real time data. Learn how with the lib documentation.

    Documentation

    Our complete documentation is available at P1PP Documentation.

    Getting help

    If you have read the documentation and are having trouble, please feel free to get in touch with us. File a support ticket if you want to make a support request, feature request, or suggestion. P1PP support is available at this link. We would love to help you by answering your private or public support requests.