XMPP是一个标准,定义了很多的规范(起源于Jabber),不同的产品都基于这些标准实现
xmpp.orghttp://xmpp.org/about-xmpp/technology-overview/
XMPP is the Extensible Messaging and Presence Protocol, a set of open technologies for instant messaging, presence, multi-party chat, voice and video calls, collaboration, lightweight middleware, content syndication, and generalized routing of XML data.
- Core — information about the core XMPP technologies for XML streaming
- BOSH — an HTTP binding for XMPP (and other) traffic
- Jingle — SIP-compatible multimedia signalling for voice, video, file transfer, and other applications
- Multi-User Chat — flexible, multi-party communication
- PubSub — alerts and notifications for data syndication, rich presence, and more
BOSH is “Bidirectional-streams Over Synchronous HTTP”, a technology for two-way communication over the Hypertext Transfer Protocol (HTTP). BOSH emulates many of the transport primitives that are familiar from the Transmission Control Protocol (TCP). For applications that require both “push” and “pull” communications, BOSH is significantly more bandwidth-efficient and responsive than most other bidirectional HTTP-based transport protocols and the techniques known as AJAX.
The XMPP Network组成Any XMPP network is composed of a number of actors. These actors can be categorized as servers,
clients, components, and server plug-ins.
XMPP servers, or more accurately, XMPP entities speaking the server-to-server protocol or the server end of the client-to-server protocol, are the circulatory system of any XMPP network.
The majority of XMPP entities are clients, which connect to XMPP servers via the client-to-server protocol.
server components. These components augment the behavior of the server by adding some new
service. These components have their own identity and address within the server, but run externally and communicate over a component protocol. component protocol XEP-0114
Many XMPP servers can also be extended via plug-ins. These plug-ins are usually written in the same programming language as the server itself and run inside the server’s processes. Their purpose overlaps to a large degree with external components, but plug-ins may also access internal server data structures and change core server behavior.
关键名词 JIDJIDs (short for jabber identifiers) elizabeth@longbourn.lit
FQDNDomain fully qualified domain name (FQDN) jabber.org
User JabberID stpeter@jabber.org
StanzasStanzas Work is accomplished in XMPP by the sending and receiving of XMPP stanzas over an XMPP stream.
3 stanzas in the main XMPP vocabulary: <message>, <presence>, and <iq>
ResourcesWhen you connect your client to an XMPP server, you choose (or the server assigns to you) a resource identifier for that particular connection. This resource is used for routing traffic to that connection instead of any other connections you might have open at the moment. The resource is added to the end of your account address, such as stpeter@jabber.org/roundabout or remko@el-tramo.be/home.
The resource is often the name of your computer, your location, or the client software you are using
XMPP URI scheme that can be used to identify JabberIDs as URIs, such as xmpp:jabber.org or xmpp:stpeter@jabber.org [RFC 5122].
Info/Query (or IQ)
life cycleEvery XMPP session has a life cycle consisting of several phases: connection, stream set up, authentication, the session body, and disconnection.
XMPP优缺点
Advantages of XMPP
XMPP has the following advantages over HTTP, each of which are explored in detail:
? Enables pushing data, not just pulling
? Firewall friendly
? Strong authentication and security
? Provides many out-of-the-box tools for solving a wide range of problems
Disadvantages of XMPP
Every protocol is a bag of both features and problems. In many cases XMPP is not the best tool for
the job or suffers from some limitation. XMPP’s drawbacks include:
? Stateful protocol
? Community and deployments are not as broad as HTTP
? More overhead than HTTP for simple chores
? Specialized implementations still needed
转载于:https://blog.51cto.com/mythinker/737577