iOS Development--Network Programming OC Chapter & (i) XMPP Brief introduction and preparation

Source: Internet
Author: User
Tags abstract definition dedicated server

XMPP Simple Introduction and preparation

First, instant communication Brief introduction

1. Brief description

Instant Messaging Technology (IM) enables users to chat online in real time. If you want to send a message, the user needs to open a small window to let the user and his friends enter the information and have both parties see what they are talking about.

There are many IM systems, such as AOL IM, Yahoo IM, MSN and QQ, their biggest difference is the implementation of their own communication protocols, so the core of instant messaging technology is its transmission protocol.

Protocol is used to describe how the information is transmitted on the network, if there is a unified transport protocol, then you should be able to achieve the direct communication between the various IM, in order to create a unified standard of instant messaging, has already appeared in the IM Protocols include: The initial protocol of the IETF Conversation Initiation Protocol (SIP) and the Instant Messaging dialog and the expression Extension Protocol (simple), Application switching Protocol (APEX), display and Instant Messaging Protocol (PRIM), and XML-based, open extensible Communication and Presentation Protocol (XMPP) protocol (often called Jabber protocol).

The industry has tried many times to unify the standards of major IM Vendors (AOL, Yahoo, and Microsoft) without success, and every IM continues to use its own protocols.

2. Compliance with XMPP Instant Messenger protocol
Design an Instant Messaging protocol that is used all over the world and can be interconnected, no matter what instant messaging software is used.

3. The significance of instant messaging in vertical social networking

Unlike the first generation of chatty's level Web site (also known as a comprehensive website), vertical sites are focusing on specific areas or specific needs, providing all-in-depth information and related services on this area or demand, and as a new highlight of the Internet, vertical websites are attracting more and more attention. In more and more networks to attract the attention of ordinary people, netizens are gradually out of fashion, curiosity of the initial stage, and constantly on the Internet to find practical, practical and affordable. With the development of mobile Internet application, more and more apps are migrating to vertical application, the communication between similar user groups in vertical application is very important, so the demand for the development of XMPP application in the domestic market is very big now.

The origin of the 4.XMPP

XMPP is an XML-based protocol for instant Messaging (IM) and online on-site probing. Initially, XMPP was developed as a framework with the goal of supporting instant messaging and online presence applications within an enterprise environment. The Instant Messaging network was private and not suitable for enterprise use. XMPP, formerly known as Jabber (1998), is an open-source organization-defined Network Instant Messaging protocol.

XMPP is a decentralized communication network, which means that any XMPP user can deliver messages to any other XMPP user as long as the network infrastructure allows. Multiple XMPP servers can also communicate with each other through a dedicated server-server protocol, providing the possibility to create decentralized social networks and collaboration frameworks.

Although XMPP appears to meet the requirements of "personal-personal" instant messaging, it does not have to be limited to this task at all.

Ii. XMPP-related

1.XMPP Introduction

XMPP is an XML-based protocol that inherits the flexibility of development in an XML environment. This indicates that XMPP is extensible. Applications such as content publishing systems and address-based services can be built on top of XMPP by sending extended information to handle the user's needs. Furthermore, XMPP contains software protocols for the server side that enable it to talk to the other, making it easier for developers to build customer applications or add functionality to a configured system.
The definition of the core XML streaming protocol for XMPP enables XMPP to be on a more standardized platform than the previous network communication protocol. With the help of XML's easy parsing and reading features, the protocol of XMPP can be very beautiful.
The Instant Messenger extension Application section of XMPP is based on an abstract definition of instant messaging by the IETF prior to this, with other widely used instant messaging protocols such as AIM,QQ, which are functionally complete and perfect.
XMPP's extended protocol jingle makes IT support voice and video, which is not yet supported by iOS.
The official documentation for XMPP is RFC 3920.
The XMPP protocol was once a Google push Instant messaging protocol, and its representative work was gtalk.

Note: Relative Xml,json is more efficient.

2.Google Talk Description

Google Talk is Google's IM tool, in addition to the IM features, plus voip features, "Clean and Generous interface", can be directly linked to Gmail, to accept the view of the mail. Because Google Talk is based on the Jabber open source standard, this standard allows users to connect to other instant messaging systems, such as the Ichat,gaim,trillian Pro and PSI for Apple computers. Google talk can only run on Windows platforms. Google Talk users cannot use this software to communicate with Aim,msn Messenger or Yahoo messenger users.

At the Google I/O conference in May 2013, Google launched the unified cross-platform chat app Hangouts (hangouts) to replace Google Talk. The XMPP protocol is not supported by Google Hangouts. Communication between Google Hangouts users and non-Google services such as strong supporters of the XMPP protocol is jabber.org.

Currently, Google Wave is based on the XMPP protocol, and Google has developed Jingle extensions for the XMPP protocol-based video chat. Although Google has not announced the closing date for talk, it will not be too far off from Google's off reader and ical support.

3.XMPP definition

Xmpp:the extensible Messaging and Presence Protocol (extensible Communication and Presentation Protocol).

XMPP can be used for streaming XML data in service class real-time communication, representation, and demand response services. XMPP is based on the Jabber protocol, while Jabber is an open protocol commonly used in instant messaging.

XMPP is an XML-based protocol for instant Messaging (IM) and online on-site probing. Facilitates quasi-immediate operations between servers. This agreement may eventually allow Internet users to send instant messages to anyone else on the internet, even if their operating systems and browsers are different.

4. Basic structure

XMPP is a typical C/s architecture, not just like most instant messaging software, using peer-to-client architecture, which means that in most cases, when two clients are communicating, their messages are delivered through the server. With this architecture, the main purpose is to simplify the client and put most of the work on the server side.

Three roles, clients, servers, and gateways are defined in XMPP. Communication can occur bidirectional between any two of these three.

The server also assumes the client information record, connection management and information routing function. The gateway undertakes the interconnection with the heterogeneous instant communication system, and the heterogeneous system can include SMS (SMS), MSN,ICQ and so on.

The basic network form is that a single client connects to a single server over TCP/IP and then transmits the XML stream on top.

Three: Principle Introduction

Brief introduction

XMPP is a subset XML protocol based on standard Common markup language, which has super extensibility. The expanded XMPP can handle user needs by sending expanded information. XMPP contains the software protocol on the server side to enable it to talk to the other. XMPP is based on the Jabber protocol, while Jabber is an open protocol commonly used in instant messaging. Standardization work is currently done by the IETF International Standards Organization.

The core of standardization is divided into two parts

    • The core XML Stream Transfer Protocol
    • Instant Messaging extended application based on Xmlfreeeim streaming (this section supports voice and video)

Advantages:

Open, it is open source, free and open to the public.
standardization, IETF Internet Engineering Working Group standardization
Mature, the first Jabber technology was developed in 1998 and is now fairly stable

Four: Start using xmppframework

This article demonstrates a project demo that runs the Xmppframework framework, which is not a mature application, but only shows how the framework is used. This demo uses only a subset of the framework's features. This article provides a detailed introduction when you decide to add the XMPP framework to your own iOS app. It is best to follow the process step-by-step, and do not skip certain steps.

SETP1:

Download the latest code

Step2

The framework has several dependent files that are automatically placed under the Vendor folder when you take xmppframework down. We will pass each dependent file over.

The first dependent package is Cocoalumberjack, its location: Vendor/cocoalumberjack. Drag into the project select Copy to ensure that the project compiles.

Step3
The second dependent package is Cocoaasyncsocket, its location: Vendor/cocoaasyncsocket, dragged into the project select Copy.
This package requires you to add Apple's cfnetwork framework and security framework. Target, Build phases, Link Binary with Libraries +--Select the Cfnetwork framework and security framework. When you are finished adding, make sure that the project compiles.
Step4
The third dependency package is kissxml, which can be found in Vendor/kissxml. Kissxml using LIBXML2, you need to add an Apple LIBXML2 library to the project file. In Targets->buildsettings->search paths-> +->/USR/INCLUDE/LIBXML2.

LIBXML2. You need to add Apple's cfnetwork framework and security framework. Target, Build phases, Link Binary with Libraries, select LIBXML2.DYLB.

When you're done, make sure the project compiles

Step5
Fourth, and the last dependent package is LIBLDN, add the following three files to the Xcode project file

    • Vendor/libidn/idn-int.h
    • Vendor/libidn/stringprep.h
    • Vendor/libidn/libidn.a

The last file is a static library that supports X86*64, i386, PPC, ARMV6, armv7 instruction set, so it is 1.3M larger. But when your app is packaged, it only extracts the files for the set of instructions your app needs to use, so don't worry about application files getting bigger. Once added, make sure the project compiles.

Step6
Add the following folder to the project

    • Authentication
    • Categories
    • Core
    • Utilities

Target---Build phases, Link Binary with Libraries +---select Libresolv.dylib, and when you're finished, make sure the project compiles.

Now you can start using Xmppframwork in your project,
The following page you can learn about its use
Https://github.com/robbiehanson/XMPPFramework/wiki/IntroToFramework


The final version of my own is this:

Add the following folder to the project

    • Authentication
    • Categories
    • Core
    • Utilities


Add vendor below the Cocoalumberjack, Cocoaasyncsocket, Kissxml, libldn files Passageway project, select Copy.

Add Apple's LIBXML2 library to the project file. At Targets->buildsettings->search paths-> +->/usr/include/libxml2

Add Apple's dynamic link library. Target---Build phases-Link Binary with Libraries +--Select Cfnetwork Framework, LIBXML2.DYLB, Security Framew Ork, Libresolv.dylib.

Finally, make sure the compilation passes.

iOS Development--Network Programming OC Chapter & (i) XMPP Brief introduction and preparation

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.