SlideShare ist ein Scribd-Unternehmen logo
1 von 57
Downloaden Sie, um offline zu lesen
XMPP intro & 101

          TheCamp - July 2012
          Steffen Larsen (slarsen@braintrust.dk)



Thursday, August 2, 12
This Presentation
                         I) Intro and presentation of the protocol
                           What is it?, Usage

                           Basics and architecture

                           Examples

                         II) Advanced Topics and loose talk
                           Extensions

                           Plugins and components

                         III) XMPP 101 - Kick start and play!


Thursday, August 2, 12
About me (blah blah)

                         Studied Computer Science @ Copenhagen
                         CEO / Founder of BrainTrust ApS 2010 (Solo Ent.)
                         Prof. Software Developer for 15+ years
                           Java (JSE / JEE), C, Erlang, Ruby, Perl.

                           Open Source developer.. Tigase, Strophe-plugins, XMPPConsole etc.




Thursday, August 2, 12
My XMPP Involvement

                Member of XMPP Standard Foundation (XSF)
                Developing XMPP since 2007 (Ms.Thesis, pidgin/VOIP)
                Done XMPP design and impl. for:
                         WAOO, Nordija (Set-top-boxes and over-the-top TV and IPTV)

                         Thrane&Thrane (Maritime Satellite Communication project)

                         Danske Spil / BetWare (Game software for Bingo etc)




Thursday, August 2, 12
XMPP Intro

                         What is it?
                           XMPP - eXtensible Message and Presence
                           Protocol
                           Earlier known as Jabber - 1998
                           Real time messages system for communication
                           Routes small snipplets of XML - called stanzas



Thursday, August 2, 12
XMPP - What?
                Who uses it? Most of you use it every day as chat..
                         You? Jabber client (pidgin/adium/messenger (m$))
                         Google (gmail, google hangouts)
                         Cisco (webex)
                         Facebook (chat)
                         Even Micro$oft have XMPP gateways integrated into
                         their messaging system


Thursday, August 2, 12
XMPP Basics

                What can you do with it?
                         Everything that you can imagine (almost) :-)
                         More than just chat -- Its about presence, routing
                         and real-time communication!
                         Real time web!.. its there - push it!




Thursday, August 2, 12
XMPP Basics	
                   Basic Services and applications
                         Encryption / Authentication

                         Presence

                         Contact / Buddy lists

                         Messaging (1-1 or group chat)

                         Push Notifications (individual or publish/subscribe)

                         Service discovery and device capability advertisement

                         Geolocation and notifications

                         Voice over IP (VOIP)

                         Collaborative text editing etc.



Thursday, August 2, 12
XMPP applications
                Set-top box and OTT implementation done my self..
                Taxi service real-time: http://cabulous.com/
                Yammer.com - work in social context (ala facebook)
                status.net - DISTRIBUTED twitter (micro blog) - download and federate..
                JIVE sbs - big social site for business / whiteboarding
                Apple mobile push
                stand-alone - adium/pidgin clients etc.
                Customer Service - chat and voip - call forwarding/queue
                games: tic-tac toe / chess
                Energy Trading software




Thursday, August 2, 12
XMPP Basics
             Why XMPP? just use normal HTTP (polling), or we
             (almost) have websockets and others..)
                    XMPP is an Open Standard (like HTTP) - XSF and the council does the work
                    openly.

                    Proven tech. Almost 15 years of dev.

                    Secure - Channel encryption and strong auth.

                    Decentralized. no stand-alone silos (hello twitter and fb..)

                    Huge community

                    Extensibility!.. We have above 300 extensions to the XMPP core




Thursday, August 2, 12
XMPP Protocol	 	
                Core specifies (RFC 6120 / RFC 6121)
                         http://xmpp.org/xmpp-protocols/rfcs/
                Connect with TCP or other transport protocols (HTTP/
                websockets, specified in extensions)
                Opening a Stream tag with with streaming XML stanzas
                (<stanza>.. stanza xml .. </stream>)
                stanzas



Thursday, August 2, 12
XMPP Architecture

                XMPP can consist of many modules:
                         Servers (many through federation)

                            Plugins

                            Components (XEP-0114)

                         Clients (typically many..)

                         Proxies

                         Database, LDAP, SIP and other systems (gateways)




Thursday, August 2, 12
XMPP Architecture




Thursday, August 2, 12
XMPP Addressing & Routing

                 Standard routing through JID
                         full JID: <id>@<domain>/<resource>

                         bare JID: <id>@<domain> (autom. resource)

                         Domain routing like normal mail (smtp).




Thursday, August 2, 12
XMPP Connection Lifecycle
     To illustrate a chat client connecting
       • Initiating TCP connection to the XMPP server
       • Opening an XML <stream> for session..
       • Negotiating stream features and SASL negotiation (Simple Authentiation
       and Security Layer)

              •Auth mechanisms: PLAIN, DIGETS-MD5, SCRAM, EXTERNAL etc.
       • TLS secure layer (authentication towards the server)
       • The clients resource gets bound to the session
       • The client sends out initial presence
       • The client can now communicate (send/receive stanzas)
       • The client ends session
       • </stream> is send. And TCP connection is closed.

Thursday, August 2, 12
Communication Primitives
          Simple, we only have 3 ways:

                Stanzas (xml snipplets that flow async.)
                         Presence
                         Message
                         IQ (Information/Query)




Thursday, August 2, 12
Stanzas: Presence
                         Sets and shows the availability of the entity that is
                         connected.
                           chat

                           away

                           dnd (do not disturb)

                         Presence for the system and the subscribers of
                         the entity (e.g. buddylist)
                         Specialized Presence extension (PEP) shows what
                         music you are playing..


Thursday, August 2, 12
Stanzas: Presence
                         // initial simple presence
                         <presence/>

                         // sending away to subscribers
                         <presence>
                            <show>away</show>
                         </presence>

                         <presence>
                            <show>dnd</show>
                            <status>I am working.. </status
                         </presence>

                         // before logging off.. more realtime
                         <presence type='unavailable'/>




Thursday, August 2, 12
Stanzas: Presence
                         // direct presence

                         <presence from='juliet@example.com balcony’
                         to='romeo@example.net'/>

                         // Capabilities.. version, voip etc.

                            <presence from='romeo@example.net'>
                              <c xmlns='http://jabber.org/protocol/caps'
                                 hash='sha-1'
                                 node='http://psi-im.org'
                                 ver='q07IKJEyjvHSyhy//CH0CxmKi8w='/>
                            </presence>




Thursday, August 2, 12
Stanzas: Message
                Using it to communicate with other clients
                TO attribute
                         full JID: direct messaging to specific entity (e.g. device/computer).

                         bare JID: will route to one or more of the connected resources - depends of
                         status, presence, message type etc.

                Type attribute (chat, normal, groupchat, headline etc) -
                presentation and routing
                Body Element - the message


Thursday, August 2, 12
Stanzas: Message
                  normal message
                  <message
                         from='juliet@example.com/balcony'
                         id='ktx72v49'
                         to='romeo@example.net'
                         type='chat'
                         xml:lang='en'>
                       <body>Hi romeo where art thou?</body>
                     </message>

                  direct message
                  <message
                         from='juliet@example.com/balcony'
                         id='ktx72v50'
                         to='romeo@example.net/thecastle'
                         type='chat'
                         xml:lang='en'>
                       <body>will you come and visit?</body>
                     </message>


Thursday, August 2, 12
Stanzas: IQ

                A more request / response model. For getting
                information and query the server / entities.
                Request: GET / SET
                Response: RESULT / ERROR
                Using it for getting roster, ad-hoc command and
                statistics for server (if admin).. etc.



Thursday, August 2, 12
Stanzas: IQ
                         Example 1: User requests current roster from server

                         UC: <iq from='romeo@example.net/orchard'
                                 id='hf61v3n7'
                                 type='get'>
                               <query xmlns='jabber:iq:roster'/>
                             </iq>

                         Example 2: User receives roster from server

                         US: <iq id='hf61v3n7'
                                 to='romeo@example.net/orchard'
                                 type='result'>
                               <query xmlns='jabber:iq:roster'>
                                 <item jid='juliet@example.com'
                                        name='Juliet'
                                        subscription='both'>
                                   <group>Friends</group>
                                 </item>
                                 <item jid='benvolio@example.org'
                                        name='Benvolio'
                                        subscription='to'/>
                                 <item jid='mercutio@example.org'
                                        name='Mercutio'
                                        subscription='from'/>
                               </query>
                             </iq>

Thursday, August 2, 12
Now.. Lets have Coffee!

                While having a break and if you want to play with XMPP
                later on..
                Install java sdk
                Install apache




Thursday, August 2, 12
II) Advanced Topics
                Extensions:
                         Pub / Sub (XEP-0060)
                         BOSH (XMPP over HTTP)
                External Database and LDAP
                Internal routing and modifications via. plugins
                Components



Thursday, August 2, 12
XMPP Extensions
                XSF defines a set of XMPP Extension Protocols (XEPs).
                > 300 at the moment
                           http://xmpp.org/xmpp-protocols/xmpp-extensions/.

                Jingle (Gtalk), MUC (hangouts), file transfer, etc..
                publish/subscribe
                We will concentrate on:
                         publish / subscribe & BOSH (XMPP on the web)


Thursday, August 2, 12
Publish / Subscribe
          (XEP-0060)

                Pub/Sub embbeds in IQ stanza
                Put JIDs into groups and push out messages to many
                subscribers!
                Let people subscribe/unsubscribe for data on a node
                Setup roles and affiliates..




Thursday, August 2, 12
Publish / Subscribe
          (XEP-0060)
                         <iq type='set'
                             from='hamlet@denmark.lit/blogbot'
                             to='pubsub.shakespeare.lit'
                             id='pub1'>
                           <pubsub xmlns='http://jabber.org/protocol/pubsub'>
                             <publish node='princely_musings'>
                               <item>
                                 <entry xmlns='http://www.w3.org/2005/Atom'>
                                   <title>Soliloquy</title>
                                   <summary>
                         To be, or not to be: that is the question:
                         Whether 'tis nobler in the mind to suffer
                         The slings and arrows of outrageous fortune,
                         Or to take arms against a sea of troubles,
                         And by opposing end them?
                                   </summary>
                                   <link rel='alternate' type='text/html'
                                         href='http://denmark.lit/2003/12/13/atom03'/>
                                   <id>tag:denmark.lit,2003:entry-32397</id>
                                   <published>2003-12-13T18:30:02Z</published>
                                   <updated>2003-12-13T18:30:02Z</updated>
                                 </entry>
                               </item>
                             </publish>
                           </pubsub>
                         </iq>

Thursday, August 2, 12
Publish / Subscribe
          (XEP-0060)
      Subscribers receives published data
                   <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>
                     <event xmlns='http://jabber.org/protocol/pubsub#event'>
                       <items node='princely_musings'>
                         <item id='ae890ac52d0df67ed7cfdf51b644e901'>
                           [ ... ENTRY ... ]
                         </item>
                       </items>
                     </event>
                   </message>

                   <message from='pubsub.shakespeare.lit' to='bernardo@denmark.lit' id='bar'>
                     <event xmlns='http://jabber.org/protocol/pubsub#event'>
                       <items node='princely_musings'>
                         <item id='ae890ac52d0df67ed7cfdf51b644e901'>
                           [ ... ENTRY ... ]
                         </item>
                       </items>
                     </event>
                   </message>



Thursday, August 2, 12
BOSH (XEP-0124)
                   Bidrectional streams Over Synchronous Http
                   (BOSH)
                         HTTPs api are great - Polling sucks.
                         Long Polling. XMPP embedded into HTTP
                         why? simple, known tech. use compress etc.
                         Small problem: cross origin policy (diff. ports)
                           default BOSH port 5280 - HTTP 80


Thursday, August 2, 12
BOSH
         HTTP hold the connection until there is something
                            to send




Thursday, August 2, 12
BOSH - XMPP over HTTP
                     POST /webclient HTTP/1.1
                     Host: httpcm.example.com
                     Accept-Encoding: gzip, deflate
                     Content-Type: text/xml; charset=utf-8
                     Content-Length: 188

                     <body rid='1249243562'
                           sid='SomeSID'
                           xmlns='http://jabber.org/protocol/httpbind'>

                         <message to='contact@example.com'
                                  xmlns='jabber:client'>
                           <body>Good morning!</body>
                         </message>

                     </body>


Thursday, August 2, 12
BOSH - XMPP over HTTP

      • No data - empty body tag from server
      • Works through header setup and timeouts

                         HTTP/1.1 200 OK
                         Content-Type: text/xml; charset=utf-8
                         Content-Length: 64

                         <body xmlns='http://jabber.org/protocol/
                         httpbind'/>




Thursday, August 2, 12
Plugins & Components




Thursday, August 2, 12
Some advanced features
                Normal client “bots” easy to do, but have limitations
                To incorporate your own business logic you need some
                more..
                To make advanced features on the server side
                         Server Plugins
                         Components
                External Auth.. either plain db, ldap or others.


Thursday, August 2, 12
Server Plugins

                Located on the server
                Change routing strategy
                Filter packages / Drop packages
                Do statistics etc.
                Bound to the server implementation - not portable
                Can hog mem/cpu from the server. Its embedded!.
                (take care)

Thursday, August 2, 12
Components (XEP-0114)
                Components conn. to the server or vice versa (normal
                TCP)
                Handshakes and authenticates (trusted by server)
                Portable
                Can be run externally with code implemented in almost
                every language.




Thursday, August 2, 12
Components (XEP-0114)

                Acts almost like a “normal” client. e.g. JID
                (comp@braintrust.dk)...
                Can act and interact on the whole domain.. not multiple
                Can alter the to/from fields...
                Can’t drop/filter packages for every domain.




Thursday, August 2, 12
Break!! ...
          Next developing XMPP 101
                    Lets have some hands-on experience.
                    Install Java (version 6 and up is fine)
                    Install Apache web server
                    Get XMPP server up and running
                    Play..




Thursday, August 2, 12
XMPP 101 - playtime!

                Install your very own XMPP server!
                Setup Apache or other httpd / proxy
                Download Strophe and setup examples..
                Play!




Thursday, August 2, 12
Developing XMPP
      Learned so far:
                XMPP can run on every device, on mobile, on the web
                on
                XMPP makes a bridge and makes the device present
                and available to communicate with other entities..
                Client frameworks for almost every language
                         Java, Javascript, C / C++, Erlang, C#, Python, Ruby, Perl etc.

                We will focus on the web (client side) and hence do
                javascript

Thursday, August 2, 12
XMPP Kick Start!
    But first! to make it work, we need a server

                  • Choose your favorite XMPP server!
                  • The list is long:  http://xmpp.org/xmpp-software/servers/


                  • Be ware of the license. Some are
                         commercial/gpl/gpl3/apache etc.




Thursday, August 2, 12
XMPP Servers

                Administrators would look for monitoring and tools.
                Extensions.. E.g. some can pub/sub, some can’t. So
                choose from your specific application.
                Clustering or not? What is your demand? 5k users?
                500k users?




Thursday, August 2, 12
My recommendations		 	
                         Ejabberd 2.1.11 (http://www.ejabberd.im/)
                           cool features dist. out-of-the-box. Thanks
                           erlang!
                           high load factor
                         Tigase 5.1.x (linux, mac etc. *NIX.)
                           very flexible. Code injection on the fly. Groovy /
                           Java. Easy to understand
                           Many extensions available
                           Good monitoring tools!
Thursday, August 2, 12
Windows users?...		

                If you can’t run shell scripts etc.
                Openfire might be easier:
                http://goo.gl/9HYeb
                Should be easy to setup.. I’ll help later. No worry. :-)




Thursday, August 2, 12
Tigase XMPP server	
                Install Java if you dont have it!

                Install tigase:

                         download http://goo.gl/jYNFD

                         run the downloaded jar file: java -jar tigase...jar

                Setup easy. in step 7, choose only base, extras and derby database. in the other
                steps just press next!

                cd {TIGASE_HOME} (where you installed it)

                Start: ./scripts/tigase.sh start etc/tigase.conf

                Stop: ./scripts/tigase.sh stop

                add a new user to the server (use a client: PSI, Adium , Pidgin etc)

Thursday, August 2, 12
Proxy setup

                         because of same origin policy.. if you have a
                         CORS enabled browser, this is not needed
                         http://httpd.apache.org/download.cgi
                         proxy_module should be enabled.
                         in httpd.conf (proxy port 80 to port 5280)
                           ProxyPass /http-bind/ http://localhost:5280/http-bind/




Thursday, August 2, 12
XMPP libraries..	

                There a many!   http://xmpp.org/xmpp-software/libraries/

                Native or BOSH (XMPP over HTTP)
                We focus on BOSH.. lets enable real-time push on the
                web.
                Strophe.js!




Thursday, August 2, 12
Strophe Install
                Download here: http://goo.gl/5btM2
                unzip / untar the downloaded package into your
                Apache web folder (on mac: Library/WebServer/
                Documents).
                You can change the folder in the httpd.conf if you want.
                change in examples/echobot.js :
                         var BOSH_SERVICE = '/http-bind/';

                Ready to run!. if server is running, fire up your browser
                and use the user created just before when logging in.

Thursday, August 2, 12
Strophe
                Pure javascript XMPP library (integrated with jquery)
                Using BOSH as connection type
                Simple manipulations with Stanzas
                Build everything like DOM
                Light and Event driven..
                Here is my example: http://localhost/webchat



Thursday, August 2, 12
Strophe

        Make connection on the BOSH URL defined in
                      apache proxy:
                         var conn = new Strophe.connection(“localhost/http-bind”);


  Connect with JID (full/bare) and make cb function:
                         conn.connect(JID, password, callbackfn);




Thursday, August 2, 12
Strophe

 Strophe have static status to check on the connection

    function onConnection () {
      if (status == Strophe.Status.CONNECTED) {
             // do something!
         } else if (status ...
         ..
    }

Thursday, August 2, 12
Strophe - Sending /
          Receiving
             conn.send(xml);....

             conn.addHandler(on_message,
                null, “message”, “chat”);
             on_message(message) {
                console.log(“Hi there: “ + message);
                return true;
             }

Thursday, August 2, 12
Strophe..

       1. function onMessage(msg) {
       2.     $(msg).find("message[type='chat'][from]:has(body)")
       3.         .each(function () {
       4.              var body = $(this).find("body:first").text();
       5.              var from = $(this).attr("from");
       6.
       7.              log('ECHOBOT: I got a message from ' + from + ': ' + body);
       8.
       9.              var reply = $msg({to: from, type: "chat"})
       10.                  .c("body")
       11.                  .t(body);
       12.              connection.send(reply.tree());
       13.
       14.              log('ECHOBOT: I sent ' + from + ': ' + body);
       15.         });
       16.}




Thursday, August 2, 12
Strophe - Stanzas..

                Strophe have convenience methods:
                $pres(attributes..);
                $msg(attributes..);
                $iq(attributes..);




Thursday, August 2, 12
Strophe - Stanzas
              Sending initial presence:
                         $pres();
         Building a message stanza:

                         $msg({to: ‘zooldk@gmail.com’, ‘type’ :
                            ‘chat’}).c(‘body’).t(‘Hello zool!’);




Thursday, August 2, 12
</stream>..the end..
                         Contact me at
                            Email/XMPP: slarsen@braintrust.dk / zooldk@gmail.com

                            LinkedIn: http://dk.linkedin.com/in/zooldk

                            Illustrations by Adrian Teh (Too lazy to draw my self..)

                            XMPP standard foundation: http://xmpp.org

                         Links
                         Server list: http://xmpp.org/xmpp-software/servers/

                         Client list: http://xmpp.org/xmpp-software/clients/

                         Libraries: http://xmpp.org/xmpp-software/libraries/

                         Strophe:

Thursday, August 2, 12

Weitere ähnliche Inhalte

Was ist angesagt?

Comunicação cliente servidor
Comunicação cliente servidorComunicação cliente servidor
Comunicação cliente servidorNascimentoeli
 
Criando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSONCriando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSONMarcio Junior Vieira
 
Análise de Algoritmos - Recursividade
Análise de Algoritmos - RecursividadeAnálise de Algoritmos - Recursividade
Análise de Algoritmos - RecursividadeDelacyr Ferreira
 
Estrutura de Dados - Aula 02 - Estrutura de Dados e TAD
Estrutura de Dados - Aula 02 - Estrutura de Dados e TADEstrutura de Dados - Aula 02 - Estrutura de Dados e TAD
Estrutura de Dados - Aula 02 - Estrutura de Dados e TADLeinylson Fontinele
 
Kanban: Aplicando TDD à melhoria contínua do seu processo
Kanban: Aplicando TDD à melhoria contínua do seu processoKanban: Aplicando TDD à melhoria contínua do seu processo
Kanban: Aplicando TDD à melhoria contínua do seu processoRodrigo Yoshima
 
TFTP - Trivial File Transfer Protocol
TFTP - Trivial File Transfer ProtocolTFTP - Trivial File Transfer Protocol
TFTP - Trivial File Transfer ProtocolPeter R. Egli
 
Postgresql + Python = Power!
Postgresql + Python = Power!Postgresql + Python = Power!
Postgresql + Python = Power!Juliano Atanazio
 
Metodologia orientado a objetos
Metodologia orientado a objetosMetodologia orientado a objetos
Metodologia orientado a objetosGabriel Faustino
 
Redes - Camada Fisica
Redes - Camada FisicaRedes - Camada Fisica
Redes - Camada FisicaLuiz Arthur
 
Teknologi gpon
Teknologi gponTeknologi gpon
Teknologi gponAmbar Erna
 
Modelo OSI - Camada Física
Modelo OSI - Camada FísicaModelo OSI - Camada Física
Modelo OSI - Camada FísicaRicardo Montania
 

Was ist angesagt? (20)

Arquitetura de Redes de Computadores
 Arquitetura de Redes de Computadores Arquitetura de Redes de Computadores
Arquitetura de Redes de Computadores
 
Comunicação cliente servidor
Comunicação cliente servidorComunicação cliente servidor
Comunicação cliente servidor
 
Criando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSONCriando e consumindo webservice REST com PHP e JSON
Criando e consumindo webservice REST com PHP e JSON
 
HTTP
HTTPHTTP
HTTP
 
Análise de Algoritmos - Recursividade
Análise de Algoritmos - RecursividadeAnálise de Algoritmos - Recursividade
Análise de Algoritmos - Recursividade
 
Estrutura de Dados - Aula 02 - Estrutura de Dados e TAD
Estrutura de Dados - Aula 02 - Estrutura de Dados e TADEstrutura de Dados - Aula 02 - Estrutura de Dados e TAD
Estrutura de Dados - Aula 02 - Estrutura de Dados e TAD
 
Kanban: Aplicando TDD à melhoria contínua do seu processo
Kanban: Aplicando TDD à melhoria contínua do seu processoKanban: Aplicando TDD à melhoria contínua do seu processo
Kanban: Aplicando TDD à melhoria contínua do seu processo
 
TFTP - Trivial File Transfer Protocol
TFTP - Trivial File Transfer ProtocolTFTP - Trivial File Transfer Protocol
TFTP - Trivial File Transfer Protocol
 
Client side scripting
Client side scriptingClient side scripting
Client side scripting
 
Postgresql + Python = Power!
Postgresql + Python = Power!Postgresql + Python = Power!
Postgresql + Python = Power!
 
Metodologia orientado a objetos
Metodologia orientado a objetosMetodologia orientado a objetos
Metodologia orientado a objetos
 
Html Básico
Html BásicoHtml Básico
Html Básico
 
Linguagem C - Ponteiros
Linguagem C - PonteirosLinguagem C - Ponteiros
Linguagem C - Ponteiros
 
Redes - Camada Fisica
Redes - Camada FisicaRedes - Camada Fisica
Redes - Camada Fisica
 
Teknologi gpon
Teknologi gponTeknologi gpon
Teknologi gpon
 
Fundamentos de Redes
Fundamentos de RedesFundamentos de Redes
Fundamentos de Redes
 
Modelo OSI - Camada Física
Modelo OSI - Camada FísicaModelo OSI - Camada Física
Modelo OSI - Camada Física
 
Estrutura de dados em Java - Filas
Estrutura de dados em Java - Filas Estrutura de dados em Java - Filas
Estrutura de dados em Java - Filas
 
Html básico 1
Html básico 1Html básico 1
Html básico 1
 
Programacao para Web I Plano de Ensinodoc
Programacao para Web I Plano de EnsinodocProgramacao para Web I Plano de Ensinodoc
Programacao para Web I Plano de Ensinodoc
 

Andere mochten auch

Realtime applications with EmberJS and XMPP
Realtime applications with EmberJS and XMPPRealtime applications with EmberJS and XMPP
Realtime applications with EmberJS and XMPPrjvegasf
 
Today: Mobile Internet, Tomorrow: What?
Today: Mobile Internet, Tomorrow: What?Today: Mobile Internet, Tomorrow: What?
Today: Mobile Internet, Tomorrow: What?Michael Harries
 
How to make a watersquare?
How to make a watersquare?How to make a watersquare?
How to make a watersquare?Dirk van Peijpe
 
XMPP - Real Time Communication
XMPP - Real Time CommunicationXMPP - Real Time Communication
XMPP - Real Time CommunicationDominic Lüchinger
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Servicesmattjive
 

Andere mochten auch (8)

Realtime applications with EmberJS and XMPP
Realtime applications with EmberJS and XMPPRealtime applications with EmberJS and XMPP
Realtime applications with EmberJS and XMPP
 
Xmpp intro 2014
Xmpp intro 2014Xmpp intro 2014
Xmpp intro 2014
 
Today: Mobile Internet, Tomorrow: What?
Today: Mobile Internet, Tomorrow: What?Today: Mobile Internet, Tomorrow: What?
Today: Mobile Internet, Tomorrow: What?
 
How to make a watersquare?
How to make a watersquare?How to make a watersquare?
How to make a watersquare?
 
Xmpp
XmppXmpp
Xmpp
 
Bitcoin
BitcoinBitcoin
Bitcoin
 
XMPP - Real Time Communication
XMPP - Real Time CommunicationXMPP - Real Time Communication
XMPP - Real Time Communication
 
Open Source XMPP for Cloud Services
Open Source XMPP for Cloud ServicesOpen Source XMPP for Cloud Services
Open Source XMPP for Cloud Services
 

Ähnlich wie XMPP Intro - The camp2012

Introducing (DET) the Data Exfiltration Toolkit
Introducing (DET) the Data Exfiltration ToolkitIntroducing (DET) the Data Exfiltration Toolkit
Introducing (DET) the Data Exfiltration ToolkitSensePost
 
Interacting with XMPP using PHP
Interacting with XMPP using PHPInteracting with XMPP using PHP
Interacting with XMPP using PHPSudar Muthu
 
Internet Of Things: Vision, Prerequisites and OpenSpime
Internet Of Things: Vision, Prerequisites and OpenSpimeInternet Of Things: Vision, Prerequisites and OpenSpime
Internet Of Things: Vision, Prerequisites and OpenSpimeRoberto Ostinelli
 
Osi model slides
Osi model slidesOsi model slides
Osi model slidesSaba Aslam
 
Erlang
ErlangErlang
ErlangESUG
 
XMPP, TV and the Semantic Web
XMPP, TV and the Semantic WebXMPP, TV and the Semantic Web
XMPP, TV and the Semantic WebDan Brickley
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Vincent Batts
 
XMPP In Real Time
XMPP In Real TimeXMPP In Real Time
XMPP In Real Timeguest488a24
 
Jmp107 Web Services
Jmp107 Web ServicesJmp107 Web Services
Jmp107 Web Servicesdominion
 
Wso2 Enterprise Capabilities Webinar
Wso2 Enterprise Capabilities WebinarWso2 Enterprise Capabilities Webinar
Wso2 Enterprise Capabilities WebinarWSO2
 
Jingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIPJingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIPmattjive
 
Xmpp presentation
Xmpp presentationXmpp presentation
Xmpp presentationJava Pro
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAguest4c923d
 
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)iXsystems
 
Volker Fröhlich - How to Debug Common Agent Issues
Volker Fröhlich - How to Debug Common Agent IssuesVolker Fröhlich - How to Debug Common Agent Issues
Volker Fröhlich - How to Debug Common Agent IssuesZabbix
 
Apache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language CommunicationApache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language CommunicationPiyush Goel
 

Ähnlich wie XMPP Intro - The camp2012 (20)

Introducing (DET) the Data Exfiltration Toolkit
Introducing (DET) the Data Exfiltration ToolkitIntroducing (DET) the Data Exfiltration Toolkit
Introducing (DET) the Data Exfiltration Toolkit
 
Communicating System
Communicating SystemCommunicating System
Communicating System
 
Interacting with XMPP using PHP
Interacting with XMPP using PHPInteracting with XMPP using PHP
Interacting with XMPP using PHP
 
Internet Of Things: Vision, Prerequisites and OpenSpime
Internet Of Things: Vision, Prerequisites and OpenSpimeInternet Of Things: Vision, Prerequisites and OpenSpime
Internet Of Things: Vision, Prerequisites and OpenSpime
 
Xmpp and java
Xmpp and javaXmpp and java
Xmpp and java
 
Osi model slides
Osi model slidesOsi model slides
Osi model slides
 
Erlang
ErlangErlang
Erlang
 
XMPP, TV and the Semantic Web
XMPP, TV and the Semantic WebXMPP, TV and the Semantic Web
XMPP, TV and the Semantic Web
 
Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]Slackware Demystified [SELF 2011]
Slackware Demystified [SELF 2011]
 
XMPP In Real Time
XMPP In Real TimeXMPP In Real Time
XMPP In Real Time
 
Ejabberd Session
Ejabberd SessionEjabberd Session
Ejabberd Session
 
Jmp107 Web Services
Jmp107 Web ServicesJmp107 Web Services
Jmp107 Web Services
 
Wso2 Enterprise Capabilities Webinar
Wso2 Enterprise Capabilities WebinarWso2 Enterprise Capabilities Webinar
Wso2 Enterprise Capabilities Webinar
 
Jingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIPJingle: Cutting Edge VoIP
Jingle: Cutting Edge VoIP
 
Os Tucker
Os TuckerOs Tucker
Os Tucker
 
Xmpp presentation
Xmpp presentationXmpp presentation
Xmpp presentation
 
Jordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISAJordan Hubbard Talk @ LISA
Jordan Hubbard Talk @ LISA
 
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
600M+ Unsuspecting FreeBSD Users (MeetBSD California 2014)
 
Volker Fröhlich - How to Debug Common Agent Issues
Volker Fröhlich - How to Debug Common Agent IssuesVolker Fröhlich - How to Debug Common Agent Issues
Volker Fröhlich - How to Debug Common Agent Issues
 
Apache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language CommunicationApache Thrift : One Stop Solution for Cross Language Communication
Apache Thrift : One Stop Solution for Cross Language Communication
 

Kürzlich hochgeladen

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 

Kürzlich hochgeladen (20)

Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 

XMPP Intro - The camp2012

  • 1. XMPP intro & 101 TheCamp - July 2012 Steffen Larsen (slarsen@braintrust.dk) Thursday, August 2, 12
  • 2. This Presentation I) Intro and presentation of the protocol What is it?, Usage Basics and architecture Examples II) Advanced Topics and loose talk Extensions Plugins and components III) XMPP 101 - Kick start and play! Thursday, August 2, 12
  • 3. About me (blah blah) Studied Computer Science @ Copenhagen CEO / Founder of BrainTrust ApS 2010 (Solo Ent.) Prof. Software Developer for 15+ years Java (JSE / JEE), C, Erlang, Ruby, Perl. Open Source developer.. Tigase, Strophe-plugins, XMPPConsole etc. Thursday, August 2, 12
  • 4. My XMPP Involvement Member of XMPP Standard Foundation (XSF) Developing XMPP since 2007 (Ms.Thesis, pidgin/VOIP) Done XMPP design and impl. for: WAOO, Nordija (Set-top-boxes and over-the-top TV and IPTV) Thrane&Thrane (Maritime Satellite Communication project) Danske Spil / BetWare (Game software for Bingo etc) Thursday, August 2, 12
  • 5. XMPP Intro What is it? XMPP - eXtensible Message and Presence Protocol Earlier known as Jabber - 1998 Real time messages system for communication Routes small snipplets of XML - called stanzas Thursday, August 2, 12
  • 6. XMPP - What? Who uses it? Most of you use it every day as chat.. You? Jabber client (pidgin/adium/messenger (m$)) Google (gmail, google hangouts) Cisco (webex) Facebook (chat) Even Micro$oft have XMPP gateways integrated into their messaging system Thursday, August 2, 12
  • 7. XMPP Basics What can you do with it? Everything that you can imagine (almost) :-) More than just chat -- Its about presence, routing and real-time communication! Real time web!.. its there - push it! Thursday, August 2, 12
  • 8. XMPP Basics Basic Services and applications Encryption / Authentication Presence Contact / Buddy lists Messaging (1-1 or group chat) Push Notifications (individual or publish/subscribe) Service discovery and device capability advertisement Geolocation and notifications Voice over IP (VOIP) Collaborative text editing etc. Thursday, August 2, 12
  • 9. XMPP applications Set-top box and OTT implementation done my self.. Taxi service real-time: http://cabulous.com/ Yammer.com - work in social context (ala facebook) status.net - DISTRIBUTED twitter (micro blog) - download and federate.. JIVE sbs - big social site for business / whiteboarding Apple mobile push stand-alone - adium/pidgin clients etc. Customer Service - chat and voip - call forwarding/queue games: tic-tac toe / chess Energy Trading software Thursday, August 2, 12
  • 10. XMPP Basics Why XMPP? just use normal HTTP (polling), or we (almost) have websockets and others..) XMPP is an Open Standard (like HTTP) - XSF and the council does the work openly. Proven tech. Almost 15 years of dev. Secure - Channel encryption and strong auth. Decentralized. no stand-alone silos (hello twitter and fb..) Huge community Extensibility!.. We have above 300 extensions to the XMPP core Thursday, August 2, 12
  • 11. XMPP Protocol Core specifies (RFC 6120 / RFC 6121) http://xmpp.org/xmpp-protocols/rfcs/ Connect with TCP or other transport protocols (HTTP/ websockets, specified in extensions) Opening a Stream tag with with streaming XML stanzas (<stanza>.. stanza xml .. </stream>) stanzas Thursday, August 2, 12
  • 12. XMPP Architecture XMPP can consist of many modules: Servers (many through federation) Plugins Components (XEP-0114) Clients (typically many..) Proxies Database, LDAP, SIP and other systems (gateways) Thursday, August 2, 12
  • 14. XMPP Addressing & Routing Standard routing through JID full JID: <id>@<domain>/<resource> bare JID: <id>@<domain> (autom. resource) Domain routing like normal mail (smtp). Thursday, August 2, 12
  • 15. XMPP Connection Lifecycle To illustrate a chat client connecting • Initiating TCP connection to the XMPP server • Opening an XML <stream> for session.. • Negotiating stream features and SASL negotiation (Simple Authentiation and Security Layer) •Auth mechanisms: PLAIN, DIGETS-MD5, SCRAM, EXTERNAL etc. • TLS secure layer (authentication towards the server) • The clients resource gets bound to the session • The client sends out initial presence • The client can now communicate (send/receive stanzas) • The client ends session • </stream> is send. And TCP connection is closed. Thursday, August 2, 12
  • 16. Communication Primitives Simple, we only have 3 ways: Stanzas (xml snipplets that flow async.) Presence Message IQ (Information/Query) Thursday, August 2, 12
  • 17. Stanzas: Presence Sets and shows the availability of the entity that is connected. chat away dnd (do not disturb) Presence for the system and the subscribers of the entity (e.g. buddylist) Specialized Presence extension (PEP) shows what music you are playing.. Thursday, August 2, 12
  • 18. Stanzas: Presence // initial simple presence <presence/> // sending away to subscribers <presence> <show>away</show> </presence> <presence> <show>dnd</show> <status>I am working.. </status </presence> // before logging off.. more realtime <presence type='unavailable'/> Thursday, August 2, 12
  • 19. Stanzas: Presence // direct presence <presence from='juliet@example.com balcony’ to='romeo@example.net'/> // Capabilities.. version, voip etc. <presence from='romeo@example.net'> <c xmlns='http://jabber.org/protocol/caps' hash='sha-1' node='http://psi-im.org' ver='q07IKJEyjvHSyhy//CH0CxmKi8w='/> </presence> Thursday, August 2, 12
  • 20. Stanzas: Message Using it to communicate with other clients TO attribute full JID: direct messaging to specific entity (e.g. device/computer). bare JID: will route to one or more of the connected resources - depends of status, presence, message type etc. Type attribute (chat, normal, groupchat, headline etc) - presentation and routing Body Element - the message Thursday, August 2, 12
  • 21. Stanzas: Message normal message <message from='juliet@example.com/balcony' id='ktx72v49' to='romeo@example.net' type='chat' xml:lang='en'> <body>Hi romeo where art thou?</body> </message> direct message <message from='juliet@example.com/balcony' id='ktx72v50' to='romeo@example.net/thecastle' type='chat' xml:lang='en'> <body>will you come and visit?</body> </message> Thursday, August 2, 12
  • 22. Stanzas: IQ A more request / response model. For getting information and query the server / entities. Request: GET / SET Response: RESULT / ERROR Using it for getting roster, ad-hoc command and statistics for server (if admin).. etc. Thursday, August 2, 12
  • 23. Stanzas: IQ Example 1: User requests current roster from server UC: <iq from='romeo@example.net/orchard' id='hf61v3n7' type='get'> <query xmlns='jabber:iq:roster'/> </iq> Example 2: User receives roster from server US: <iq id='hf61v3n7' to='romeo@example.net/orchard' type='result'> <query xmlns='jabber:iq:roster'> <item jid='juliet@example.com' name='Juliet' subscription='both'> <group>Friends</group> </item> <item jid='benvolio@example.org' name='Benvolio' subscription='to'/> <item jid='mercutio@example.org' name='Mercutio' subscription='from'/> </query> </iq> Thursday, August 2, 12
  • 24. Now.. Lets have Coffee! While having a break and if you want to play with XMPP later on.. Install java sdk Install apache Thursday, August 2, 12
  • 25. II) Advanced Topics Extensions: Pub / Sub (XEP-0060) BOSH (XMPP over HTTP) External Database and LDAP Internal routing and modifications via. plugins Components Thursday, August 2, 12
  • 26. XMPP Extensions XSF defines a set of XMPP Extension Protocols (XEPs). > 300 at the moment http://xmpp.org/xmpp-protocols/xmpp-extensions/. Jingle (Gtalk), MUC (hangouts), file transfer, etc.. publish/subscribe We will concentrate on: publish / subscribe & BOSH (XMPP on the web) Thursday, August 2, 12
  • 27. Publish / Subscribe (XEP-0060) Pub/Sub embbeds in IQ stanza Put JIDs into groups and push out messages to many subscribers! Let people subscribe/unsubscribe for data on a node Setup roles and affiliates.. Thursday, August 2, 12
  • 28. Publish / Subscribe (XEP-0060) <iq type='set'     from='hamlet@denmark.lit/blogbot'     to='pubsub.shakespeare.lit'     id='pub1'>   <pubsub xmlns='http://jabber.org/protocol/pubsub'>     <publish node='princely_musings'>       <item>         <entry xmlns='http://www.w3.org/2005/Atom'>           <title>Soliloquy</title>           <summary> To be, or not to be: that is the question: Whether 'tis nobler in the mind to suffer The slings and arrows of outrageous fortune, Or to take arms against a sea of troubles, And by opposing end them?           </summary>           <link rel='alternate' type='text/html'                 href='http://denmark.lit/2003/12/13/atom03'/>           <id>tag:denmark.lit,2003:entry-32397</id>           <published>2003-12-13T18:30:02Z</published>           <updated>2003-12-13T18:30:02Z</updated>         </entry>       </item>     </publish>   </pubsub> </iq> Thursday, August 2, 12
  • 29. Publish / Subscribe (XEP-0060) Subscribers receives published data <message from='pubsub.shakespeare.lit' to='francisco@denmark.lit' id='foo'>   <event xmlns='http://jabber.org/protocol/pubsub#event'>     <items node='princely_musings'>       <item id='ae890ac52d0df67ed7cfdf51b644e901'>         [ ... ENTRY ... ]       </item>     </items>   </event> </message> <message from='pubsub.shakespeare.lit' to='bernardo@denmark.lit' id='bar'>   <event xmlns='http://jabber.org/protocol/pubsub#event'>     <items node='princely_musings'>       <item id='ae890ac52d0df67ed7cfdf51b644e901'>         [ ... ENTRY ... ]       </item>     </items>   </event> </message> Thursday, August 2, 12
  • 30. BOSH (XEP-0124) Bidrectional streams Over Synchronous Http (BOSH) HTTPs api are great - Polling sucks. Long Polling. XMPP embedded into HTTP why? simple, known tech. use compress etc. Small problem: cross origin policy (diff. ports) default BOSH port 5280 - HTTP 80 Thursday, August 2, 12
  • 31. BOSH HTTP hold the connection until there is something to send Thursday, August 2, 12
  • 32. BOSH - XMPP over HTTP POST /webclient HTTP/1.1 Host: httpcm.example.com Accept-Encoding: gzip, deflate Content-Type: text/xml; charset=utf-8 Content-Length: 188 <body rid='1249243562'       sid='SomeSID'       xmlns='http://jabber.org/protocol/httpbind'>   <message to='contact@example.com'            xmlns='jabber:client'>     <body>Good morning!</body>   </message> </body> Thursday, August 2, 12
  • 33. BOSH - XMPP over HTTP • No data - empty body tag from server • Works through header setup and timeouts HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: 64 <body xmlns='http://jabber.org/protocol/ httpbind'/> Thursday, August 2, 12
  • 35. Some advanced features Normal client “bots” easy to do, but have limitations To incorporate your own business logic you need some more.. To make advanced features on the server side Server Plugins Components External Auth.. either plain db, ldap or others. Thursday, August 2, 12
  • 36. Server Plugins Located on the server Change routing strategy Filter packages / Drop packages Do statistics etc. Bound to the server implementation - not portable Can hog mem/cpu from the server. Its embedded!. (take care) Thursday, August 2, 12
  • 37. Components (XEP-0114) Components conn. to the server or vice versa (normal TCP) Handshakes and authenticates (trusted by server) Portable Can be run externally with code implemented in almost every language. Thursday, August 2, 12
  • 38. Components (XEP-0114) Acts almost like a “normal” client. e.g. JID (comp@braintrust.dk)... Can act and interact on the whole domain.. not multiple Can alter the to/from fields... Can’t drop/filter packages for every domain. Thursday, August 2, 12
  • 39. Break!! ... Next developing XMPP 101 Lets have some hands-on experience. Install Java (version 6 and up is fine) Install Apache web server Get XMPP server up and running Play.. Thursday, August 2, 12
  • 40. XMPP 101 - playtime! Install your very own XMPP server! Setup Apache or other httpd / proxy Download Strophe and setup examples.. Play! Thursday, August 2, 12
  • 41. Developing XMPP Learned so far: XMPP can run on every device, on mobile, on the web on XMPP makes a bridge and makes the device present and available to communicate with other entities.. Client frameworks for almost every language Java, Javascript, C / C++, Erlang, C#, Python, Ruby, Perl etc. We will focus on the web (client side) and hence do javascript Thursday, August 2, 12
  • 42. XMPP Kick Start! But first! to make it work, we need a server • Choose your favorite XMPP server! • The list is long: http://xmpp.org/xmpp-software/servers/ • Be ware of the license. Some are commercial/gpl/gpl3/apache etc. Thursday, August 2, 12
  • 43. XMPP Servers Administrators would look for monitoring and tools. Extensions.. E.g. some can pub/sub, some can’t. So choose from your specific application. Clustering or not? What is your demand? 5k users? 500k users? Thursday, August 2, 12
  • 44. My recommendations Ejabberd 2.1.11 (http://www.ejabberd.im/) cool features dist. out-of-the-box. Thanks erlang! high load factor Tigase 5.1.x (linux, mac etc. *NIX.) very flexible. Code injection on the fly. Groovy / Java. Easy to understand Many extensions available Good monitoring tools! Thursday, August 2, 12
  • 45. Windows users?... If you can’t run shell scripts etc. Openfire might be easier: http://goo.gl/9HYeb Should be easy to setup.. I’ll help later. No worry. :-) Thursday, August 2, 12
  • 46. Tigase XMPP server Install Java if you dont have it! Install tigase: download http://goo.gl/jYNFD run the downloaded jar file: java -jar tigase...jar Setup easy. in step 7, choose only base, extras and derby database. in the other steps just press next! cd {TIGASE_HOME} (where you installed it) Start: ./scripts/tigase.sh start etc/tigase.conf Stop: ./scripts/tigase.sh stop add a new user to the server (use a client: PSI, Adium , Pidgin etc) Thursday, August 2, 12
  • 47. Proxy setup because of same origin policy.. if you have a CORS enabled browser, this is not needed http://httpd.apache.org/download.cgi proxy_module should be enabled. in httpd.conf (proxy port 80 to port 5280) ProxyPass /http-bind/ http://localhost:5280/http-bind/ Thursday, August 2, 12
  • 48. XMPP libraries.. There a many! http://xmpp.org/xmpp-software/libraries/ Native or BOSH (XMPP over HTTP) We focus on BOSH.. lets enable real-time push on the web. Strophe.js! Thursday, August 2, 12
  • 49. Strophe Install Download here: http://goo.gl/5btM2 unzip / untar the downloaded package into your Apache web folder (on mac: Library/WebServer/ Documents). You can change the folder in the httpd.conf if you want. change in examples/echobot.js : var BOSH_SERVICE = '/http-bind/'; Ready to run!. if server is running, fire up your browser and use the user created just before when logging in. Thursday, August 2, 12
  • 50. Strophe Pure javascript XMPP library (integrated with jquery) Using BOSH as connection type Simple manipulations with Stanzas Build everything like DOM Light and Event driven.. Here is my example: http://localhost/webchat Thursday, August 2, 12
  • 51. Strophe Make connection on the BOSH URL defined in apache proxy: var conn = new Strophe.connection(“localhost/http-bind”); Connect with JID (full/bare) and make cb function: conn.connect(JID, password, callbackfn); Thursday, August 2, 12
  • 52. Strophe Strophe have static status to check on the connection function onConnection () { if (status == Strophe.Status.CONNECTED) { // do something! } else if (status ... .. } Thursday, August 2, 12
  • 53. Strophe - Sending / Receiving conn.send(xml);.... conn.addHandler(on_message, null, “message”, “chat”); on_message(message) { console.log(“Hi there: “ + message); return true; } Thursday, August 2, 12
  • 54. Strophe.. 1. function onMessage(msg) { 2. $(msg).find("message[type='chat'][from]:has(body)") 3. .each(function () { 4. var body = $(this).find("body:first").text(); 5. var from = $(this).attr("from"); 6. 7. log('ECHOBOT: I got a message from ' + from + ': ' + body); 8. 9. var reply = $msg({to: from, type: "chat"}) 10. .c("body") 11. .t(body); 12. connection.send(reply.tree()); 13. 14. log('ECHOBOT: I sent ' + from + ': ' + body); 15. }); 16.} Thursday, August 2, 12
  • 55. Strophe - Stanzas.. Strophe have convenience methods: $pres(attributes..); $msg(attributes..); $iq(attributes..); Thursday, August 2, 12
  • 56. Strophe - Stanzas Sending initial presence: $pres(); Building a message stanza: $msg({to: ‘zooldk@gmail.com’, ‘type’ : ‘chat’}).c(‘body’).t(‘Hello zool!’); Thursday, August 2, 12
  • 57. </stream>..the end.. Contact me at Email/XMPP: slarsen@braintrust.dk / zooldk@gmail.com LinkedIn: http://dk.linkedin.com/in/zooldk Illustrations by Adrian Teh (Too lazy to draw my self..) XMPP standard foundation: http://xmpp.org Links Server list: http://xmpp.org/xmpp-software/servers/ Client list: http://xmpp.org/xmpp-software/clients/ Libraries: http://xmpp.org/xmpp-software/libraries/ Strophe: Thursday, August 2, 12