XMPP Protocol and Application Development using Open Source
- Slides: 45
XMPP Protocol and Application Development using Open Source XMPP Software and Libraries Ozgur Ozturk ozturk@gatech. edu Georgia Institute of Technology, Atlanta, GA Acknowledgement: This tutorial is based on the book “XMPP: The Definitive Guide, Building Real-Time Applications with Jabber Technologies” with permission from Peter Saint-Andre.
Access to This Tutorial • Latest version of slides available on – http: //Dr. Ozturk. com/talks • Also useful for clicking on links 2
Software that you will need to repeat exercises with me • Start downloads now – In the break you will have time to install • Visual C# 2008 Express Edition – http: //www. microsoft. com/express/downloads/ • Eclipse IDE for Java Developers (92 MB) – http: //www. eclipse. org/downloads/ • Openfire & Spark Code: – http: //www. igniterealtime. org/downloads/source. jsp – Tortoise. SVN recommended for subversion check out • http: //tortoisesvn. net/downloads • Jabber. Net code: – http: //code. google. com/p/jabber-net/ 3
Part 1 Introduction to XMPP
What is XMPP • Extensible Messaging and Presence Protocol – open, XML-based protocol – aimed at near-real-time, extensible • instant messaging (IM), and • presence information. • Extended with features such as Voice over IP and file transfer signaling – and even expanded into the broader realm of message-oriented middleware 5
Samples from its Usage • IM and Social Networking platforms – GTalk, and Facebook • Collaborative services – Google Wave, and Gradient; • Geo-presence systems – Nokia Ovi Contacts • Multiplayer games – Chesspark • Many online live customer support and technical support services. 6
Overview of Tutorial Introduction to XMPP IM and Presence requirements, XML Refresher XMPP Extension Protocols (XEPs) Hands on exercises/demonstrations of using some Open Source XMPP Libraries, Clients and Servers • Architecture options & extending XMPP • Talk slides, code and links will be available on http: //Dr. Ozturk. com/talks • • 7
SIMPLE (contender to XMPP) • SIMPLE: SIP for Instant Messaging and Presence Leveraging Extensions • SIP: Session Initiation Protocol, established signaling protocol for VOIP and IPTV 8
Advantages of XMPP • Open XML standard formalized by IETF – Extensible for new service or information types – Implementations with modular/pluggable APIs • Continuously extended through the standards process of the XMPP Standards Foundation • XMPP servers (via federation) form a decentralized network similar to e-mail – anyone (with a domain) can run an XMPP server 9
Some XMPP Terminology • Jabber. ID (JID): address of XMPP entities – JIDs for users look like email addresses, composed of username, “@” sign and the domain – Bare JID + Resource Identifier = Full JID: • e. g. , ozgur 7@gmail. com/web-9 z 2 • Routing traffic to one connection of user, web-client rather than mobile or desktop client (which may be simultaneously connected) 10
Three Types of XMPP Stanzas • Stanza: Basic unit of communication in XMPP • Libraries abstract away from the XML layer – However to extend XMPP we need to know basics • Three types of Stanzas: – Message • method for getting info from one place to another – Presence • availability and status messages of entities – iq (Info/Query) • request-response interactions and simple workflows 11
XML Refresher XML Basics Terminology <? xml version="1. 0" encoding="ISO-8859 -1"? > <CATALOG> • Entity, Tag <CD> • Schema <TITLE>Unchain my heart</TITLE> <ARTIST NAME="Joe Cocker" /> • DTD, XSD <COUNTRY>USA</COUNTRY> <COMPANY>EMI</COMPANY> • Well-formed <PRICE>8. 20</PRICE> • Valid <YEAR>1987</YEAR> </CD> Attribute <!– Add more CD Albums here… --> • Not recommended for data. • Prefer to use element: </CATALOG> Special Syntax for empty elements, where closing tag would come immediately after opening tag <ARTIST> <NAME> Joe Crocker </NAME> </ARTIST> 12 • Recommended for metadata
XML Refresher Sample XML Standard: POSLog Namespaces needed for combining multiple existing vocabularies, to prevent conflict of names. Namespaces are not applied to attributes, unless you specify them explicitly. 13
XML Refresher XML Namespaces Not a URL, just a namespace! 14
XML Refresher Same Local Name, Different Qualified Names <bk: bookstore xmlns: bk="urn: xmlns: dozturk. com: books"> <bk: book bk: title="Lord of the Rings, Book 3"> <book for=“Ozgur Ozturk“/> </bk: bookstore> These two are from two vocabularies. One of the <book> tags means reserving. 15
Three Basic XMPP Stanza Types: 1: Message Stanza • The “push” method for getting information from one place to another <message from="ozgur 7@gmail. com/wz 2" to="stpeter@jabber. org" type="chat"> from address <body>How are you? </body> • not provided by sending client, <subject>Query</subject> • stamped by the </message> sender’s server • to avoid address spoofing 16
Three Basic XMPP Stanza Types: 2: Presence Messages • Advertises the network availability and status messages of entities • A specialized publish-subscribe method; people who requested subscription to your presence and authorized by you receive updated presence information when you come online, and go offline, and change your status 17
Three Basic XMPP Stanza Types: 2: Presence Stanza <presence from="ozgur 7@gmail. com/android-z 2"> <show>do not disturb</show> <status>in a meeting</status> </presence> 18
Three Basic XMPP Stanza Types: 3: IQ (Info/Query) Messages • Structure for request-response interactions and simple workflows. • Requests and responses are tracked using the id attribute • type attribute included in the exchanged iq stanzas helps in establishing a structured IQ interaction between two entities • Next example: IM client software gets my roster from its server and then updates it 19
Three Basic XMPP Stanza Types: 3: IQ (Info/Query) Stanza 1/4: Requesting Roster <iq from="ozgur 7@gmail. com/wz 2" id="rr 82 a 1 z 7" to="ozgur 7@gmail. com" type="get"> <query xmlns="jabber: iq: roster"/> </iq> 20
Three Basic XMPP Stanza Types: 3: IQ (Info/Query) Stanza 2/4: Server Returning Roster <iq from="ozgur 7@gmail. com" id="rr 82 a 1 z 7" to="ozgur 7@gmail. com/wz 2" type="result"> <query xmlns="jabber: iq: roster"> <item jid="frnd 1@gmail. com"/> <item jid="spouse@facebook. com"/> </query> • </iq> 21
Three Basic XMPP Stanza Types: 3: IQ (Info/Query) Stanza 3/4: Client adds a new contact. <iq from="ozgur 7@gmail. com/wz 2" id="ru 761 vd 7" New transaction, new id. to="ozgur 7@gmail. com" type="set"> <query xmlns="jabber: iq: roster"> <item jid="stpeter@jabber. org"/> </query> </iq> 22
Three Basic XMPP Stanza Types: 3: IQ (Info/Query) Stanza 4/4: Server’s Acknowledgement <iq from="ozgur 7@gmail. com" Same id with request. id="ru 761 vd 7" to="ozgur 7@gmail. com/wz 2" type="result“/> Each request needs a reply. Even if it is empty 23
15 Minute Break Now is the time to install your software When we are back we will code, yay! 24
Part 2 Coding a Basic Client Without re-implementing the wheel: Using Jabber-Net. Net Library
Download Link for. Net XMPP library • XMPP Library for. Net (written in C#) http: //code. google. com/p/jabber-net/ – I recommend to install from source code • So you can trace into the library code upon errors • I will show to add components to toolbar manually 26
Download and install Jabber-Net 27
28
My. First. Client project 29
Visual Studio Toolbox with Jabber-Net 30
Simplest Client App Double Click 31
Five lines of code • Automatically added events and function templates: • Just fill in the action: 32
Voila! Our Weather Bot is Working 33
Part 3 XMPP Extension Protocols (XEPs)
Extensibility and Available XEPs • XMPP is an XML based, extensible protocol • XMPP Standards Foundation (XSF) standardizes extensions to XMPP through a process centered around XMPP Extension Protocols (XEPs) – http: //xmpp. org/extensions/ 35
Data Forms XEP • Specifies how a server sends the information necessary for a client to render a form • Defines several common field types – boolean, – list options with single or multiple choice, – text with single line or multiple lines, – hidden fields, … – & extensibility for future data types • Related extension: CAPTCHA Forms XEP 36
In-Band Registration XEP • For in-band registration, password change or cancellation of an existing registration • Extensible via use of data forms – enables services to gather a wide range of information during the registration process 37
Multi-User Chat XEP • To enable multiple XMPP users to exchange messages in the context of a room or channel – similar to Internet Relay Chat (IRC). • Standard chat-room features such as room topics and invitations • A strong room control model, adds ability to: – kick and ban users – name room moderators and administrators – require membership or passwords to join the room 38
Publish-Subscribe XEP & Personal Eventing Protocol (PEP) XEP • Presents a more generalized form of the publish/subscribe model than presence – communicating “rich presence” such as moods – exchanging “lifestreaming” data, such as microblogs – also applied to storing personal data • Bookmarks, client preferences… • Further extensions of PEP – User Tune, User Location, and User Activity XEPs 39
Multimedia Networking Extensions: Jingle XEP • XMPP as the signaling channel to negotiate, manage & terminate media sessions – voice/video chat, file transfer, screen sharing… – negote media codecs, bitrates and other parameters related to the voice format to be used, deciding whether TCP or UDP will be used – what IP addresses and ports will be used, etc • Media data itself is sent either p 2 p or through a media relay. 40
Part 4 Compiling and Customizing Openfire XMPP Server and Spark Chat Client 41
Download Links for Client and Server with Pluggable API • Open. Fire: XMPP server • Spark: XMPP client • Both are open source Java implementation, with multi-platform support • Openfire & Spark Code: – http: //www. igniterealtime. org/downloads/source. jsp – Tortoise. SVN recommended for subversion check out • http: //tortoisesvn. net/downloads 42
43
44
DELETED SLIDES 45
- Xmpp development
- Xmpp rfc
- Open source advantages and disadvantages
- Open source cluster application resources
- Oscar cluster
- 영국 beis
- Open source development model
- Application level protocol
- Snmp
- Application-layer protocol negotiation
- Open flow protocol
- Openflow protocol
- Internet open trading protocol
- Open core protocol
- Lims software for library
- Module 4 - open source software and licensing
- Open source command and control software
- Benefits of open source software in education
- Flight information display system and open source
- File sender uga
- Rapid prototyping in software engineering
- Online platforms for ict content development
- Rad design workshop
- Characteristics of rapid software development
- Wrt os
- Hadoop is open source
- Open source electronics prototyping platform
- Open source pbx
- Nato osint
- Open source sdn projects
- Intrusion detection open source
- Open source java games
- Open source private cloud solutions
- Open source job schedulers
- Pentaho open source
- Dual mode in os
- Open source search engines
- Cross platform vpn
- Open source unified communications
- Open source software integrator
- Motion control software open source
- Ged software
- Open source erp framework
- Mpower crm
- David the robot
- Open source