XMPP的简介和基本概念
XMPP是一个标准,定义了很多的规范(起源于Jabber),不同的产品都基于这些标准实现
xmpp.org
http://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.
关键名词
JID
JIDs (short for jabber identifiers) elizabeth@longbourn.lit
FQDN
Domain fully qualified domain name (FQDN) jabber.org
User JabberID stpeter@jabber.org
Stanzas
Stanzas 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>
Resources
When 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 cycle
Every 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
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
2010-12-08 绝非偶然 苹果iPhone领先5年背后的迷思 【推荐】