Develop your own XMPP im

Source: Internet
Author: User

I haven't shown my face on my blog recently. Why is it a class? At the request of a senior engineer, I helped him study an XMPP im
Software development. There are no major events recently. I want to write them every day.CodeThe trainer can help you. I thought it was quite interesting to study it. I checked the domestic and foreign data over the past few days and found the domestic software on this aspect.
I want to write a few articles about IM software development.Article. But don't look at things as small as possible. There are many modules involved.

Therefore, I have basically divided into three articles to introduce the development of such software:

The first article is about the XMPP protocol, Im, and a well-known open-source implementation. The open-source implementation includes three parts (spark, smack, and openfire );

The second section describes how to develop the spark-based client im plug-in;

Article 3 describes how to develop plug-ins Based on the openfire server.

Now, let's go to the topic.

What is XMPP?
Extensible
Messaging and presence
Protocol, in simple terms, is a protocol for sending and receiving and processing messages, but the messages sent by this Protocol are neither binary nor string, but XML. It is precisely because
XML is used as the intermediary for message transmission. extensible is talking about it, isn't it? Hey. I will not introduce more details. You can go to Baidu encyclopedia and check the link here.

What is Im?

Instant Messenger and timely communication software are QQ, MSN Messenger, and Gtalk. Gtalk
It is an implementation based on the XMPP protocol, while others are not. Current im
Almost every netman must use tools. There are some enterprise-level IM applications in large foreign enterprises, but their commercial value has not yet been fully realized. Assume that XMPP
A protocol is a public protocol, so every enterprise can use it to develop im suitable for its own business and improve its production efficiency; or even, you can also integrate this communication software in online games, not only
You can play and chat, or develop im suitable for the game itself
For example, some key game scenario reminders and team voice communication functions can be implemented based on IM. If you say so much, it means that the commercial value is much higher than you think!

Spark smack and openfire

There are always a lot of interesting things in the open-source world. These three are combined into a complete XMPP im
. Including the server -- openfire, client -- spark, and XMPP
The implementation of the transport protocol-smack (Remember, XMPP is a protocol that needs to be implemented, and smack plays such a role ). All three are based on Java
Therefore, it is not difficult for developers familiar with Java to implement the language.

Spark
It provides a basic implementation of the client and a good plug-in architecture. This is a good news for developers. I strongly recommend that you implement your new functions based on plug-ins instead
Modify itSource codeIn this way, it will benefit your project architecture and minimize the impact of the original project. later sections of this article will also be developed based on this plug-in system.

Openfire is an im Based on XMPP protocol
Although two users can send messages in point-to-point mode after connection, the user still needs to connect to the server to obtain some connection information and communication information.
The device must be implemented. Openfire also provides some basic functions, but it is really basic! Fortunately, it also provides plug-in extensions, such as SPARK
Similarly, I strongly recommend using plug-in extensions to add new features, rather than modifying people's source code.

Smack is a Java implementation of XMPP protocol and provides a set of scalable APIs. However, sometimes you still have to use your own custom XML file content to implement your own functions.

Shows the relationship between the three:
It can be seen from the figure that both the client and server can be extended through plug-ins, and smack is the medium for both to transmit data.

Well, let's write it here today. It takes a long time to draw a picture. The next article describes how to develop spark-based plug-ins.ProgramAnd summarize some of my own experiences. For example, we need to parse and generate some XML files, as well as APIS provided by Spark and smack, some basic ant knowledge

Add to favorites: Del. icio. us

 
Copyright Disclaimer: During reprinting, please use hyperlinks to indicate the original source and author information of the article and this statement
Http://phoenixtoday.blogbus.com/logs/17246727.html

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.