XMPP introduction

本文介绍了XMPP(Extensible Messaging and Presence Protocol),一种由Jabber开源社区于1999年开发的开放XML技术,用于实时通信和在线状态更新。XMPP是一种基于XML的即时消息和在线状态协议,由非营利组织Jabber Software Foundation支持。文章还列举了一些服务器端和客户端的应用实例,并提供了一个使用Smack库进行Java客户端开发的示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

XMPP is Extensible Messaging and Presence Protocol (XMPP),
a set of open XML technologies for presence and real-time communication developed by the Jabber open-source community in 1999.

XMPP is an open, XML-based protocol for [color=red]instant messaging[/color] and presence, supported by the non-profit Jabber Software Foundation.

[color=red]Jabber[/color] is a IM technology over [b]XMPP[/b] protocol.
XMPP is the core protocal of Jabber

Jabber is an open instant messaging technology that anyone can use.
the application sphere over the XMPP protocol

[url]http://xmpp.org[/url]

[b]Server-side:[/b]
[url]http://xmpp.org/software/servers.shtml[/url]

Openfire ([url]http://www.igniterealtime.org/projects/openfire[/url])
OpenIM ([url]http://www.openim.techlab.smk.fr/en/page1.xml[/url])

Citadel
CommuniGate Pro
djabberd
ejabberd
IceWarp
iChat Server
in.jabberd
Isode M-Link
jabberd 1.x
jabberd 2.x
Jabber XCP
Jerry Messenger
Prosody
psyced
Sun Java System Instant Messaging
synapse
Tigase
Wokkel

[b]Client-side:[/b]
Pidgin, Google Talk...

[b]Open source library to develope client-side:[/b]
[url]http://xmpp.org/software/libraries.shtml[/url]

Smack 3.1[url]http://www.igniterealtime.org/projects/smack/index.jsp[/url]
Echomine Feridian
IP*Works Internet Toolkit
Jabber Stream Objects (JSO)

[color=green]Smack is an Open Source XMPP (Jabber) client library for instant messaging and presence. A pure Java library, it can be embedded into your applications to create anything from a full XMPP client to simple XMPP integrations such as sending notification messages and presence-enabling devices. [/color]

[b]XMPP Extensions:[/b]
[url]http://xmpp.org/extensions/[/url]

XEP - XMPP Extension Protocol(XEP).
[url]http://xmpp.org/extensions/xep-0166.html[/url]

XEP-0166: Jingle
This specification defines an XMPP protocol extension for initiating and managing peer-to-peer media sessions between two XMPP entities
in a way that is interoperable with existing Internet standards.
The protocol provides a pluggable model that enables the core session management semantics (compatible with SIP) to be used
for a wide variety of application types (e.g., voice chat, video chat, file transfer) and with a wide variety of transport methods
(e.g., TCP, UDP, ICE, application-specific transports).

[b]Server-side configuration with OpenFire[/b]
1) Unpack it, run openfire_3.63\bin\openfire.exe

2) Create database in MySQL
CREATE DATABASE openfire_db;
GRANT ALL PRIVILEGES ON openfire_db.* TO 'xmlasia'@'%' IDENTIFIED BY 'xmlasia' WITH GRANT OPTION;

3) Setup Server at http://127.0.0.1:9090
louislingster@gmail.com/xml-full
Login to console: admin/xml-full

[b]Client-side java sample using smack:[/b]
1) add dependencies: smack.jar,smackx.jar
2) java code

static void test() throws Exception {
ConnectionConfiguration config = new ConnectionConfiguration("192.168.1.2", 5222);
XMPPConnection conn = new XMPPConnection(config);
conn.connect();

conn.login("louis", "louis", "");

ChatManager chatmanager = conn.getChatManager();
Chat chat = chatmanager.createChat("bob@localhost", new MessageListener() {
public void processMessage(Chat chat, Message message) {
System.out.println("Received: " + message.getBody());
}
});

try {
chat.sendMessage("Hello, Bob");
}
catch (XMPPException e) {
System.out.println("Error Delivering block");
}

Thread.sleep(Long.MAX_VALUE);
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值