XMPP Study Notes 1

Source: Internet
Author: User
Tags starttls

Recently, due to development needs, we need to integrate instant messaging tools on Oa. we originally planned to use RTX or MSN, but there was no relevant source code. It was difficult to integrate with specific services and finally we gave up. I am also looking for open-source products, but I cannot find them.. NET development has a server and a client, C ++ and Java, but unfortunately they only do. net.

I found a lot of information on the Internet and decided to implement an XMPP-based communication tool, including the server and client. XMPP is used because XMPP is standard and C #

Open-source class libraries are available.
The predecessor of XMPP is jabber, an open-source network instant communication protocol. XMPP has been standardized by IETF International Standards Organization. The core results of standardization are divided into two parts;
Core XML Stream Transmission Protocol rfc3920
XML-Based Instant Messaging extension application rfc3921
In addition, the XMPP standards Foundation also defines many other expansion specifications. See the XMPP Official Website: http://xmpp.org/here there are all RFC related to xmppx

And XMPP extended protocols. The above also lists some software that implements the protocol, including the server and client.

People with poor English skills can also view

Http://wiki.jabbercn.org/index.php/~~~µ µthis is a Chinese website for XMPP, which translates the main XMPP protocol.

Currently, the XMPP development library on the. NET platform mainly includes: agsxmpp sdk ip * works Internet Toolkit jabber-net and so on.
We recommend that you use agsxmpp for development.

XMPP transmits data based on XML. Generally, the C/S mode is used. The client connects to the client over TCP and keeps the connection. Currently, HTTP is also implemented.

The client and server exchange information through XML streams.

The following is a piece of information transmitted during logon: (this is the logon process of spark)

C stands for client S stands for server

C: <stream: stream to = "1" xmlns = "jabber: client" xmlns: stream = "http://etherx.jabber.org/streams" version = "1.0">

S: <stream: stream from = 'hp520' xmlns = 'jabber: client' xmlns: stream = 'HTTP: // etherx.jabber.org/streams' id = 'a7747277-ad62-4813-b739-63504d6e1246 'version = '1. 0 'xml: lang = 'zh-cn'>

S: <stream: features xmlns = "http://etherx.jabber.org/streams"> <starttls xmlns = "urn: IETF: Params: XML: NS: XMPP-TLS"/> <mechanisms xmlns = "urn: IETF: Params: XML: NS: XMPP-sasl "> <mechanical> plain </mechanical> <mechanical> DIGEST-MD5 </mechanical> </mechanical ISMs> <compression xmlns =" http://jabber.org/features/compress "> <method> zlib </Method> </compression> <auth xmlns = "http://jabber.org/features/iq-auth"/> <register xmlns = "http://jabber.org/features/iq-register"/> </stream: features>

C: <starttls xmlns = "urn: IETF: Params: XML: NS: XMPP-TLS"/>

S: <proceed xmlns = "urn: IETF: Params: XML: NS: XMPP-TLS"/>

C: <stream: stream to = "hp520" xmlns = "jabber: client" xmlns: stream = "http://etherx.jabber.org/streams" version = "1.0">

S: <stream: stream from = 'hp520' xmlns = 'jabber: client' xmlns: stream = 'HTTP: // etherx.jabber.org/streams' id = 'a7747277-ad62-4813-b739-63504d6e1246 'version = '1. 0 'xml: lang = 'zh-cn'>
<Stream: features xmlns = "http://etherx.jabber.org/streams"> <mechanic ISMs xmlns = "urn: IETF: Params: XML: NS: XMPP-sasl "> <mechanical> plain </mechanical> <mechanical> DIGEST-MD5 </mechanical> </mechanical ISMs> <compression xmlns =" http://jabber.org/features/compress "> <method> zlib </Method> </compression> <auth xmlns = "http://jabber.org/features/iq-auth"/> <register xmlns = "http://jabber.org/features/iq-register"/> </stream: features>

C: <auth mechanic = "plain" xmlns = "urn: IETF: Params: XML: NS: XMPP-sasl"> agh4dwax </auth>

S: <success xmlns = "urn: IETF: Params: XML: NS: XMPP-sasl"/>

C: <stream: stream to = "hp520" xmlns = "jabber: client" xmlns: stream = "http://etherx.jabber.org/streams" version = "1.0">

S: <stream: stream from = 'hp520' xmlns = 'jabber: client' xmlns: stream = 'HTTP: // etherx.jabber.org/streams' id = 'a7747277-ad62-4813-b739-63504d6e1246 'version = '1. 0 'xml: lang = 'zh-cn'>
<Stream: features xmlns = "http://etherx.jabber.org/streams"> <compression xmlns = "http://jabber.org/features/compress"> <method> zlib </method> </compression> <bind xmlns = "urn: IETF: params: XML: NS: XMPP-bind "/> <session xmlns =" urn: IETF: Params: XML: NS: XMPP-session "/> </stream: features>

C: <IQ id = "O193v-0" type = "set"> <bind xmlns = "urn: IETF: Params: XML: NS: XMPP-bind "> <resource> spark </resource> </Bind> </IQ>

S: <IQ xmlns = "jabber: client" id = "O193v-0" type = "result"> <bind xmlns = "urn: IETF: Params: XML: NS: XMPP-bind "> <resource> spark </resource> <jid> hxw @ hp520/spark </jid> </Bind> </IQ>

C: <IQ id = "O193v-1" type = "set"> <session xmlns = "urn: IETF: Params: XML: NS: XMPP-session"/> </IQ>

S: <IQ xmlns = "jabber: client" id = "O193v-1" type = "result"> <session xmlns = "urn: IETF: Params: XML: NS: XMPP-session "/> </IQ>

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.