XMPP - PowerPoint PPT Presentation

1 / 20
About This Presentation
Title:

XMPP

Description:

... devices that listen on an XMPP chat room or that exchange information directly. ... It allows several users to be in a chat room. ... – PowerPoint PPT presentation

Number of Views:359
Avg rating:3.0/5.0
Slides: 21
Provided by: Office20041603
Category:
Tags: xmpp

less

Transcript and Presenter's Notes

Title: XMPP


1
XMPP
  • Extensible Messaging and Presence Protocol

2
Chat
  • In the beginning there was instant messaging and
    chat.
  • Lots of binary standards
  • Unix talk, IRC, AOL Instant Messaging (AIM)
    Yahoo, MS, etc.
  • The commercial implementations quickly tried to
    achieve user lock-in via proprietary protocols.
    (Aside you make money in the computer industry
    by owning standards, such as the Windows API. If
    you own the standard you can lock other
    implementors out.)

3
Better Way
  • Why not do something open standards that any one
    can implement.
  • Which is what XMPP is--open standard, published
    by the IETF, that uses XML to exchange
    information.
  • XML allows user-readability the classic benefits
    of XML

4
Whats Handled?
  • Presence who is online right now? Are they
    willing to talk?
  • Instant Messaging real-time communications
    between two or more users
  • real time roughly means that you see the
    text each time the user hits return
  • Some show each character as it is typed
  • Chat groups of people exchanging information in
    a chat room
  • Information exchange Since XMPP uses XML, we can
    exchange information that can be expressed in XML

5
Presence Buddy List
My status--available for IMs
Buddies
Off Line buddies
6
How Does XMPP Work?
ltmessage to'romeo_at_example.net'
from'juliet_at_example.com/balcony'
type'chat'
xmllang'en'gt ltbodygtWherefore art
thou, Romeo?lt/bodygt lt/messagegt
7
XMPP Stanzas
  • There are three basic stanzas or elements in
    XMPP
  • message
  • presence here I am. Tell all my subscribers
    about my status
  • iq info/query, request/response
  • In addition these elements all have five common
    attributes defined
  • to JID of recipient
  • from JID of sender
  • id can be a unique ID assigned to each stanza
  • type varies by stanza
  • xmllang used to specify human language

8
XMPP
Server
Client
TCP connection between client and server.
Typically this is negotiated over SSL or TLS (a
follow-on version of SSL) so that the traffic is
encrypted and secure. XML stanzas are exchanged
across this channel
9
XMPP
  • The XML is sent as an open-ended stream. A stream
    starts with ltstreamgt, then an open-ended series
    of ltpresencegt, ltmessagegt, and ltiqgt tags are sent.
  • When the closing lt/streamgt tag is sent, the
    underlying TCP connection is torn down

10
XML Communications Backplane
  • We can also add new XML to the existing standard
    to get new capabilities
  • You should think of XMPP not as strictly chat,
    but as an XML-enabled communications backplane
  • Anyone can subscribe to a server and receive XML
    messages from other users. We can use this as a
    way to do lots of things besides chat.

11
XMPP
Device
User
XMPP Communications
Device
User
12
Communications
  • You can place programs or devices that listen on
    an XMPP chat room or that exchange information
    directly.
  • Now there are devices or programs listening
    rather than humans
  • Can use XML to exchange data objects
  • You can also tie in XMPP with multimedia,
    including voice
  • The jingle API (included w/ smack) allows voice

13
XMPP Basics
  • You have a client that connects to and
    authenticates to a server.
  • Users are uniquely identified by their JID, in
    the form username_at_fqhn.com, eg jamesbond_at_mi6.gov.u
    k

14
Multi User Chat (MUC)
  • Multiuser chat is an add-on to the XMPP
    specification. It allows several users to be in a
    chat room.
  • The convention is for a chat server to have the
    DNS name conference.machine.name, eg
    conference.savage.nps.edu
  • The muc is identified by the jid
    roomname_at_conference.machine.name, eg
  • Moves_at_conference.savage.nps.edu

15
Server-to-Server
  • Notice that a client connects to a local server,
    but the JID for a chat or muc may be on another
    machine
  • Example you log onto savage.nps.edu, and you
    specify that you want to chat with someone at
    smith_at_googletalk.com
  • (For firewall reasons this wont work right now.)
  • To do this, the server you have logged onto
    establishes a server-to-server connection to the
    machine specified in the JID

16
Server-to-Server
remote.com
Local.com
Local Chat Server
Remote Chat Server
Client Foo_at_local.com
Client Bar_at_remote.com
17
Server-to-Server
  • If the user isnt on the same box that you logged
    onto, the server will contact the server the user
    is logged onto and pass the message to that
    server
  • The users do not need to be logged onto the same
    machine to chat with each other

18
APIs
  • What does it take to write an XMPP participant?
    It turns out, not very much.
  • The Smack API from Ignite Realtime lets you get
    up and running fairly quickly.
  • The examples Ill show use the Smack 3.0 API
    available at http//www.igniterealtime.org/downloa
    ds/index.jsp

19
Smack API
// Creates a new connection, using TLS if
possible. XMPPConnection connection
new XMPPConnection("savage.nps.edu") connection.c
onnect() // Login connection.login("testuser",
"foobar")
20
Smack API
MultiUserChat muc new MultiUserChat(connectio
n,
"moves_at_conference.savage.nps.edu"
) muc.join("studmuffin") for(int
idx 0 idx lt 10 idx)
muc.sendMessage("Hello world")
Thread.sleep(1000)
Write a Comment
User Comments (0)
About PowerShow.com