OpenFire introduction and deployment based on XMPP openfire smack development [1]

Source: Internet
Author: User
Tags ldap domain server

Objective

http://blog.csdn.net/shimiso/article/details/8816558

The Java field of Instant Messaging solutions can be considered openfire+spark+smack. There are other options, of course.

OpenFire is an Instant Messaging server-side version that is based on the Jabber Protocol (XMPP), which is currently recommended to use the 3.8.1 version, which is currently the latest version and can be found on the web for downloaded source code.

Instant Messaging client can use spark2.6.3, this version is currently the latest release version, after testing found that the previous version in video support, MSN Gateway Support may have problems, so choose openfire3.8.1+spark2.6.3 is the most appropriate choice.

Smack is a real-time communication client programming library, and I have already measured through the JSP using the Smack API to send a message to OpenFire registered user, and the listener can obtain the user's reply message.

Through smack to MSN users and QQ users, gtalk users send messages should also be implemented, about sending messages to gtalk users more examples. This is left to be studied later. At least now you can send messages to spark through the program. For LAN internal application is enough to solve the problem of system and user interaction, even can do automatic answering robot.

Spark supports chat, voice, video, conferencing, file transceiver, screenshots, connect MSN and other functions.

1. What is XMPP

XMPP (extensible Messaging and Presence Protocol), in simple terms, it is a Send receive processing message protocol, but this Protocol sends the message, neither binary nor string, but XML. It is because of the use of XML as the intermediary of message delivery, extensible to talk about. XMPP's predecessor was Jabber, an open source form of organization-generated network Instant Messaging protocol. XMPP is currently being standardized by the IETF International Standards Organization.

2.IM

Instant Messenger, timely communication software, is the use of QQ, MSN Messenger and Gtalk and so on. Where Gtalk is based on an implementation of the XMPP protocol, others are not. Im almost always used as a tool for every surfer, there are some enterprise-level IM applications in large enterprises abroad, but their commercial value has not been fully utilized. Imagine that since the XMPP protocol is an open protocol, each enterprise can use it to develop the IM that suits its business, improve its productivity, and even, you can integrate this communication software in the network game, not only lets you chat while playing the game, but also can develop an IM application suitable for the game itself. For example, some game key scene alert function, team voice communication and so on can be based on IM.

3.spark,smack and OpenFire

There is always a lot of fun in the open source world, and these three together are a complete XMPP IM implementation. Including server-side--openfire, the implementation of the client--SPARK,XMPP Transport protocol--smack (remember, XMPP is a protocol, the Protocol needs to be implemented, Smack is such a role). All three are based on the Java language implementation.

Spark provides a basic implementation of the client and presents a good plug-in architecture, which is a boon for developers. I strongly recommend that you implement your new functionality based on plug-ins instead of changing the source code, which will help you to minimize the impact of the original project.

OpenFire is a server-side implementation of the XMPP protocol-based IM, although when two users connect, the message can be sent by point-to-point mode, but the user still needs to connect to the server to obtain some connection information and communication information, so the server side is necessary to implement. OpenFire also offers some basic features, but really very basic! Fortunately, it also provides plug-in extensions, like Spark, and it is also strongly recommended to use plug-in extensions to add new functionality instead of modifying the source code of others.

Smack is a Java implementation of the XMPP protocol that provides a set of extensible APIs, but sometimes you have to implement your own functionality by customizing the content of the XML file you send yourself.

Shows the relationship between the three:

Spark provides a basic implementation of the client and presents a good plug-in architecture, which is a boon for developers. I strongly recommend that you implement your new functionality based on plug-ins instead of changing the source code, which will help you to minimize the impact of the original project.

OpenFire is a server-side implementation of the XMPP protocol-based IM, although when two users connect, the message can be sent by point-to-point mode, but the user still needs to connect to the server to obtain some connection information and communication information, so the server side is necessary to implement. OpenFire also offers some basic features, but really very basic! Fortunately, it also provides plug-in extensions, like Spark.

Smack is a Java implementation of the XMPP protocol that provides a set of extensible APIs, but sometimes you have to implement your own functionality by customizing the content of the XML file that you send yourself.

4. Installing Openfire3.8.1

Use OpenFire to configure the domain name of the machine. If you do not have a domain server installed on your LAN, you will need to manually configure the domain name for the machine, open the C:\WINDOWS\system32\drivers\etc\hosts file, and add a new line:
127.0.0.1 csdn.shimiso.com (Users can configure the name according to their needs, but preferably with the domain name format)
Other machines use the domain name to access the OpenFire, also need to C:\WINDOWS\system32\drivers\etc\ The hosts specify the IP address of the bzwang.tzsoft.com, assuming that the host IP for the openfire is 192.168.1.10, the Hosts file should have a new line added:
192.168.1.10 csdn.shimiso.com
Specifying the host domain name in this way, it is recommended to install OpenFire machine configuration static IP address to avoid IP changes.

Language selection Simplified Chinese, see:

Follow the prompts to install, click Finish to start OpenFire, and finally appear the following interface:

Click "Launch Admin", the following page appears, the page is connected to http://127.0.0.1:9090/setup/index.jsp

Language Select Chinese (Simplified), click "Continue": (The following page if the English, please refresh the page or re-click Launch Admin)

This page of domain defaults to the machine name, please change the domain name set at the beginning, for example csdn.shimiso.com, then point continue (Continue):

The first option on this page, the standard database connection, do not select the embedded database (Embedded database, the embedded databases are HSQLDB databases, the production environment does not select this option), and then click "Continue":

Here I use the MySQL database, according to the official requirements of the best is more than 5.0, to ensure that there is a name called OpenFire inventory in, well after the point to continue

This page is configured to use LDAP, we do not configure LDAP now, so choose Default defaults, click Continue:

After filling in the mailbox and confirming the password, proceed directly: Wait about 30 seconds, until this installation and configuration operation is complete. Open the http://127.0.0.1:9090/login.jsp Login Administration page

Enter user/group to add a new user.

5. Client Configuration and debugging

I didn't use the official spark client here, but instead used the Pandian and Ruyi, configured as follows:

Chat Demo:

From the above chat record we found all the user ID name is: username @ domain Name/resource name, this is what we usually say in the XMPP protocol Jid, that is, Jabber ID, it is an XMPP protocol account system, This parameter is often used in the subsequent debugging interface with the Smack programming library.

PS: The course for the original if there is a coincidence is purely coincidental welcome various forms of technical exchanges, joint discussion and treatise

OpenFire introduction and deployment based on XMPP openfire smack development [1]

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.