SlideShare une entreprise Scribd logo
1  sur  12
A Beginner’s Guide to XMPP 
Soham 
Sengupta 
CEO, Tech IT Easy Lab of Pervasive VM Computing 
+91 9830740684 (sohamsengupta@yahoo.com)
XMPP : what and why? 
 Existing Web Technologies have 2 broad categories 
 Pull (Example HTTP where connection is initiated by Client and 
initial communication is unidirectional (HTTP Request) 
 Push (Where communication is initiated by clients but connection 
is bi-directional, and keeps alive till disconnection or log-out ) 
 Need and utility of (Server) Push: 
 Real time Messaging (IM) like Google Talk, Facebook chat etc 
 Delicate and urgent information like Stocks quotes that need be 
initiated to clients 
 Real time Location tracking 
 News feeds 
 Cricket scores
XMPP a Push Protocol 
 Extensible Messaging and Presence Protocol 
In G-talk you find if the other 
end is typing, entered message 
or her status like busy, idle, 
away etc
Jabber 
 Jabber may refer to: 
 The original name of the Extensible Messaging and 
Presence Protocol (XMPP), the open technology for 
instant messaging and presence. 
 Jabber.org, the public, free instant messaging and 
presence service based on the XMPP protocol. 
 Jabber XCP, a commercial product which is an 
implementation of the XMPP protocol. Acquired 
by Cisco Systems in 2008.
Smack 
1. Smack is an Open Source XMPP (Jabber) client 
library for instant messaging and presence. 
2. A pure Java library 
3. It can be embedded into your applications to create 
anything from a full XMPP client to simple XMPP 
integrations such as sending notification messages 
and presence-enabling devices. 
4. We learn in next slides how to use Smack and 
make a simple Java application client for XMPP
Smack: Getting started 
1. Pre-requites: 
a) Java SE 1.4 or above, SDK, language basics and concept 
b) An active Internet connection 
c) At least two Google accounts 
d) The Jabber Smack API Download Site 
2. Step-1 
a) Have the 2 jar files, 
i. Samck.jar 
ii. Smackx.jar 
that come with the API in your build path (CLASSPATH) 
a) We make sure that the two Google id can chat with each other, 
i.e. they are friend to each other 
b) We make sure we are connected to Internet
Smack Tutorials 
 Some useful terms: 
 Roster 
 A list, especially of names : Dictionary meaning 
 While we chat we refer to our Friends in chat list as Roster 
 Connect to an XMPP Server 
1. 5222: default Port for XMPP (used by most of the providers) 
2. We connect to talk.google.com with our google (gmail) id and 
password
Code Snippets to Connect 
XMPPConnection  The Java type that represents an XMPP connection 
 It needs a ConnectionConfiguration object to set up 
 The configuration object needs host, port and service name 
 connection.connect() connects to the server & no authentication (login) done 
 connection.login(user,password) succeeds on an Active Network if user and 
pasword are valid, else fails
Connection set up continued… 
XMPP Server Port Number User ID Password 
My password not 
shown here
Send a Text Message 
XMPPConnection 
Text Message 
Chat type 
message 
Recipient ID 
Add text 
Output console and 
browser notification
Listen For An Incoming Message 
Output
References You can study 
http://www.igniterealtime.org/projects/smack/ 
http://xmpp.org/about-xmpp/technology-overview/ 
https://peepcode.com/products/xmpp

Contenu connexe

Tendances

Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By ShanmugamNavaneethan Naveen
 
FaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search EngineFaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search EngineDongsun Kim
 
Java programming basics
Java programming basicsJava programming basics
Java programming basicsHamid Ghorbani
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaMonika Mishra
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Pythondidip
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingAkhil Kaushik
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#Rizwan Ali
 
Java - Processing input and output
Java - Processing input and outputJava - Processing input and output
Java - Processing input and outputRiccardo Cardin
 
Os Saintandre
Os SaintandreOs Saintandre
Os Saintandreoscon2007
 
Secure Communications with Jabber
Secure Communications with JabberSecure Communications with Jabber
Secure Communications with Jabberstpeter
 
NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsTorben Hoffmann
 
Programming in Java: Organising Your Code
Programming in Java: Organising Your CodeProgramming in Java: Organising Your Code
Programming in Java: Organising Your CodeMartin Chapman
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in javaRaghu nath
 

Tendances (20)

Python session.11 By Shanmugam
Python session.11 By ShanmugamPython session.11 By Shanmugam
Python session.11 By Shanmugam
 
Taking User Input in Java
Taking User Input in JavaTaking User Input in Java
Taking User Input in Java
 
FaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search EngineFaCoY – A Code-to-Code Search Engine
FaCoY – A Code-to-Code Search Engine
 
Java programming basics
Java programming basicsJava programming basics
Java programming basics
 
Threads c sharp
Threads c sharpThreads c sharp
Threads c sharp
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 
Threading in C#
Threading in C#Threading in C#
Threading in C#
 
Java Threads
Java ThreadsJava Threads
Java Threads
 
Socket Programming In Python
Socket Programming In PythonSocket Programming In Python
Socket Programming In Python
 
advanced java ppt
advanced java pptadvanced java ppt
advanced java ppt
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
Threads And Synchronization in C#
Threads And Synchronization in C#Threads And Synchronization in C#
Threads And Synchronization in C#
 
Java - Processing input and output
Java - Processing input and outputJava - Processing input and output
Java - Processing input and output
 
Os Saintandre
Os SaintandreOs Saintandre
Os Saintandre
 
Secure Communications with Jabber
Secure Communications with JabberSecure Communications with Jabber
Secure Communications with Jabber
 
Java solution
Java solutionJava solution
Java solution
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
NDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business NeedsNDC London 2014: Erlang Patterns Matching Business Needs
NDC London 2014: Erlang Patterns Matching Business Needs
 
Programming in Java: Organising Your Code
Programming in Java: Organising Your CodeProgramming in Java: Organising Your Code
Programming in Java: Organising Your Code
 
Multithreading in java
Multithreading in javaMultithreading in java
Multithreading in java
 

Similaire à Xmpp and java

Onesocialweb Presentation at OTA10
Onesocialweb Presentation at OTA10Onesocialweb Presentation at OTA10
Onesocialweb Presentation at OTA10dianacheng
 
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPPScalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPPUdaya Kiran
 
Chat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPChat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPGenora Infotech
 
Interacting with XMPP using PHP
Interacting with XMPP using PHPInteracting with XMPP using PHP
Interacting with XMPP using PHPSudar Muthu
 
Next Video Build: XMTP Workshop Slides
Next Video Build: XMTP Workshop SlidesNext Video Build: XMTP Workshop Slides
Next Video Build: XMTP Workshop SlidesNeven6
 
Ejabberd with xmpp
Ejabberd with xmppEjabberd with xmpp
Ejabberd with xmppPrem Narain
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftTalentica Software
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupMickaël Rémond
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...IndicThreads
 
Mit302 web technologies
Mit302 web technologiesMit302 web technologies
Mit302 web technologiessmumbahelp
 
Skype and icq referat final - copy
Skype and icq referat   final - copySkype and icq referat   final - copy
Skype and icq referat final - copyMatej Kostroš
 
Jaimin chp-7 - application layer- 2011 batch
Jaimin   chp-7 - application layer- 2011 batchJaimin   chp-7 - application layer- 2011 batch
Jaimin chp-7 - application layer- 2011 batchJaimin Jani
 
Introduction to Slack App Development
Introduction to Slack App Development Introduction to Slack App Development
Introduction to Slack App Development Serhat Can
 
Mit302 web technologies
Mit302 web technologiesMit302 web technologies
Mit302 web technologiessmumbahelp
 

Similaire à Xmpp and java (20)

Communicating System
Communicating SystemCommunicating System
Communicating System
 
Onesocialweb Presentation at OTA10
Onesocialweb Presentation at OTA10Onesocialweb Presentation at OTA10
Onesocialweb Presentation at OTA10
 
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPPScalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
Scalable Real Time Chat (Text, Audio, Video) - Implemented using XMPP
 
Chat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIPChat app case study - xmpp vs SIP
Chat app case study - xmpp vs SIP
 
Interacting with XMPP using PHP
Interacting with XMPP using PHPInteracting with XMPP using PHP
Interacting with XMPP using PHP
 
Next Video Build: XMTP Workshop Slides
Next Video Build: XMTP Workshop SlidesNext Video Build: XMTP Workshop Slides
Next Video Build: XMTP Workshop Slides
 
Ejabberd with xmpp
Ejabberd with xmppEjabberd with xmpp
Ejabberd with xmpp
 
Email security
Email securityEmail security
Email security
 
XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)XML-RPC and SOAP (April 2003)
XML-RPC and SOAP (April 2003)
 
Building scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thriftBuilding scalable and language independent java services using apache thrift
Building scalable and language independent java services using apache thrift
 
A vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF MeetupA vision for ejabberd - ejabberd SF Meetup
A vision for ejabberd - ejabberd SF Meetup
 
Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...Building scalable and language-independent Java services using Apache Thrift ...
Building scalable and language-independent Java services using Apache Thrift ...
 
Openfire
OpenfireOpenfire
Openfire
 
Mit302 web technologies
Mit302 web technologiesMit302 web technologies
Mit302 web technologies
 
Skype and icq referat final - copy
Skype and icq referat   final - copySkype and icq referat   final - copy
Skype and icq referat final - copy
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Jaimin chp-7 - application layer- 2011 batch
Jaimin   chp-7 - application layer- 2011 batchJaimin   chp-7 - application layer- 2011 batch
Jaimin chp-7 - application layer- 2011 batch
 
Introduction to Slack App Development
Introduction to Slack App Development Introduction to Slack App Development
Introduction to Slack App Development
 
Mit302 web technologies
Mit302 web technologiesMit302 web technologies
Mit302 web technologies
 
application layer
application layerapplication layer
application layer
 

Plus de Soham Sengupta (20)

Spring method-level-secuirty
Spring method-level-secuirtySpring method-level-secuirty
Spring method-level-secuirty
 
Spring security mvc-1
Spring security mvc-1Spring security mvc-1
Spring security mvc-1
 
JavaScript event handling assignment
JavaScript  event handling assignment JavaScript  event handling assignment
JavaScript event handling assignment
 
Networking assignment 2
Networking assignment 2Networking assignment 2
Networking assignment 2
 
Networking assignment 1
Networking assignment 1Networking assignment 1
Networking assignment 1
 
Sohams cryptography basics
Sohams cryptography basicsSohams cryptography basics
Sohams cryptography basics
 
Network programming1
Network programming1Network programming1
Network programming1
 
JSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorialJSR-82 Bluetooth tutorial
JSR-82 Bluetooth tutorial
 
Core java day2
Core java day2Core java day2
Core java day2
 
Core java day4
Core java day4Core java day4
Core java day4
 
Core java day5
Core java day5Core java day5
Core java day5
 
Exceptions
ExceptionsExceptions
Exceptions
 
Java.lang.object
Java.lang.objectJava.lang.object
Java.lang.object
 
Jsp1
Jsp1Jsp1
Jsp1
 
Soham web security
Soham web securitySoham web security
Soham web security
 
Html tables and_javascript
Html tables and_javascriptHtml tables and_javascript
Html tables and_javascript
 
Html javascript
Html javascriptHtml javascript
Html javascript
 
Java script
Java scriptJava script
Java script
 
Sohamsg ajax
Sohamsg ajaxSohamsg ajax
Sohamsg ajax
 
Dhtml
DhtmlDhtml
Dhtml
 

Dernier

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 

Dernier (20)

ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Xmpp and java

  • 1. A Beginner’s Guide to XMPP Soham Sengupta CEO, Tech IT Easy Lab of Pervasive VM Computing +91 9830740684 (sohamsengupta@yahoo.com)
  • 2. XMPP : what and why?  Existing Web Technologies have 2 broad categories  Pull (Example HTTP where connection is initiated by Client and initial communication is unidirectional (HTTP Request)  Push (Where communication is initiated by clients but connection is bi-directional, and keeps alive till disconnection or log-out )  Need and utility of (Server) Push:  Real time Messaging (IM) like Google Talk, Facebook chat etc  Delicate and urgent information like Stocks quotes that need be initiated to clients  Real time Location tracking  News feeds  Cricket scores
  • 3. XMPP a Push Protocol  Extensible Messaging and Presence Protocol In G-talk you find if the other end is typing, entered message or her status like busy, idle, away etc
  • 4. Jabber  Jabber may refer to:  The original name of the Extensible Messaging and Presence Protocol (XMPP), the open technology for instant messaging and presence.  Jabber.org, the public, free instant messaging and presence service based on the XMPP protocol.  Jabber XCP, a commercial product which is an implementation of the XMPP protocol. Acquired by Cisco Systems in 2008.
  • 5. Smack 1. Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. 2. A pure Java library 3. It can be embedded into your applications to create anything from a full XMPP client to simple XMPP integrations such as sending notification messages and presence-enabling devices. 4. We learn in next slides how to use Smack and make a simple Java application client for XMPP
  • 6. Smack: Getting started 1. Pre-requites: a) Java SE 1.4 or above, SDK, language basics and concept b) An active Internet connection c) At least two Google accounts d) The Jabber Smack API Download Site 2. Step-1 a) Have the 2 jar files, i. Samck.jar ii. Smackx.jar that come with the API in your build path (CLASSPATH) a) We make sure that the two Google id can chat with each other, i.e. they are friend to each other b) We make sure we are connected to Internet
  • 7. Smack Tutorials  Some useful terms:  Roster  A list, especially of names : Dictionary meaning  While we chat we refer to our Friends in chat list as Roster  Connect to an XMPP Server 1. 5222: default Port for XMPP (used by most of the providers) 2. We connect to talk.google.com with our google (gmail) id and password
  • 8. Code Snippets to Connect XMPPConnection  The Java type that represents an XMPP connection  It needs a ConnectionConfiguration object to set up  The configuration object needs host, port and service name  connection.connect() connects to the server & no authentication (login) done  connection.login(user,password) succeeds on an Active Network if user and pasword are valid, else fails
  • 9. Connection set up continued… XMPP Server Port Number User ID Password My password not shown here
  • 10. Send a Text Message XMPPConnection Text Message Chat type message Recipient ID Add text Output console and browser notification
  • 11. Listen For An Incoming Message Output
  • 12. References You can study http://www.igniterealtime.org/projects/smack/ http://xmpp.org/about-xmpp/technology-overview/ https://peepcode.com/products/xmpp