XMPP Client library smack version 4.0.6 development

Source: Internet
Author: User

XMPP Client library smack version 4.0.6 development

CHSZS, reprint need to indicate. Blog home: Http://blog.csdn.net/chszs

The characteristics of Smack library
1. Extremely easy to use, powerful API
Sending a text message to a user requires only a few lines of code:

Abstractxmppconnection connection = new Xmpptcpconnection ("Mtucker", "Password", "jabber.org"); Connection.connect (); Connection.login (); Chat chat = chatmanager.getinstancefor (connection). Createchat ("[Email protected]", new MessageListener () {public void ProcessMessage (chat chat, message message) {SYSTEM.OUT.PRINTLN ("Received message:" + message);}); Chat.sendmessage ("howdy!");

2, isolated the complexity of the underlying packet assembly, naturally have a corresponding library to complete these functions. Smack provides more intelligent high-level constructs such as the chat class and the roster class, which makes development more efficient.
1) There is no need to familiarize yourself with the XML format of XMPP, or even to understand XML
2) provides a simple communication
Smack allows developers to set a large number of properties for each message, which can also contain Java objects.
3) Open source code based on Apache license, which means you can put smack into your own business software.

Iv. composition of the Smack library
The smack library can be embedded into any Java application. The Smack library is composed of several jar files and is very flexible.
1, Smack-core.jar
Provides the core XMPP functionality. Are XMPP attributes that are defined by the XMPP RFC specification.
2, Smack-extensions.jar
Supports many of the extended (XEP) features defined by the XMPP Standards Foundation. This includes group chat, file transfer, user search, and more.
Later, you can view the documentation extension Guide:
Https://github.com/igniterealtime/Smack/blob/master/documentation/extensions/index.html
(Currently invalid)
3, Smack-experimental.jar
Supports many of the experiential (XEP) features defined by the XMPP Standards Foundation. Its API and functionality are considered to be unstable.
4, Smack-legacy.jar
Supports many legacy (XEP) features defined by the XMPP Standards Foundation.
5, Smack-bosh.jar
Supports Bosh communication (defined by the XEP-0124 specification). This code is considered to be in the beta phase.
6, Smack-jingle.jar
Support Jingle. This code is very old and is currently in a state of no maintenance.
7, Smack-resolver-dnsjava.jar
Supports parsing of DNS SRV records, primarily for platforms that do not support the Javax.naming API.
8, Smack-debug.jar
Enhanced GUI debugger for protocol traffic. When debug mode is turned on, it is automatically used if it is under the classpath.
You can view the document debug mode later:
Https://github.com/igniterealtime/Smack/blob/master/documentation/debugging.html
(Currently invalid)

v. Configuration of Smack
The initialization process for smack involves a 2-phase invocation.
1. Initialize System Properties
All system accessible properties are initialized through the Smackconfiguration class, and these properties are retrieved from the property value by means of the GetXXX method.
2. Initialize Startup class
Any class that inherits the Smackinitializer interface can be initialized after calling the Initialize () method, which means that the class that gets initialized is active after it is started.
If the Smackinitializer interface is not inherited, the initialization must be done by placing a static block of code that is executed automatically when the class is loaded.

Initialization is done through a configuration file. By default, smack loads the configuration file embedded in the Smack jar file (it is located in Org.jivesoftware.smack/smack-config.xml). This specified configuration file contains a list of classes that need to be loaded into the initialization. All classes of the manager type need to be initialized, and these manager classes are included in the initialization list described above.


XMPP Client library smack version 4.0.6 development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.