返回
关于我们
分类

除了一个新闻客户端的搭建,2018年08月02日Smack正式发由了4澳门新浦京娱乐游戏:.2.2版

日期: 2020-04-25 17:26 浏览次数 : 80

摘要Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的,2018年08月02日Smack正式发由了4.3版。前言Smack是著名的开源XMPP客户端库,另一个开源IM全功能客户端Spark就是基于此库编写的(Spark或其修改版被众多国内中小企业作为内部沟通工具),2018年08月02日Smack正式发由了4.2.2版,此版为小幅更新版。更新内容Bug[SMACK-759]

  最进开始做一些android的项目,除了一个新闻客户端的搭建,还需要一个实现一个即时通讯的功能,参考了很多大神成型的实例,了解到operfire+asmack是搭建简易即时通讯比较方便,所以就写了这篇博客。

 1 package com.travellife.Smack;
 2 
 3 import org.jivesoftware.smack.Chat;
 4 import org.jivesoftware.smack.ChatManager;
 5 import org.jivesoftware.smack.ConnectionConfiguration;
 6 import org.jivesoftware.smack.MessageListener;
 7 import org.jivesoftware.smack.PacketListener;
 8 import org.jivesoftware.smack.XMPPConnection;
 9 import org.jivesoftware.smack.XMPPException;
10 import org.jivesoftware.smack.filter.PacketFilter;
11 import org.jivesoftware.smack.filter.PacketTypeFilter;
12 import org.jivesoftware.smack.packet.Message;
13 import org.jivesoftware.smack.packet.Packet;
14 
15 /**
16  * 一个简单的XMPPConnection示例
17  */
18 public class Smack {
19     public static XMPPConnection con;
20     public static Chat newChat;
21     public static ChatManager chatmanager;
22 
23     public static void main(String[] args) throws InterruptedException {
24         try {
25             // 配置域和端口号,域可以换成IP地址
26             ConnectionConfiguration config = new ConnectionConfiguration(
27                     "www.travellife.com", 5222);
28             // 新建一个XMPPConnection对象
29             con = new XMPPConnection(config);
30 
31             // 连接服务器
32             con.connect();
33             // 用户登录
34             con.login("lion", "1025263614");
35             // 是否已经通过身份验证
36             System.out.println("Authenticated = " + con.isAuthenticated());
37 
38             addListener();
39             // 获取一个ChatManager对象
40             chatmanager = con.getChatManager();
41             newChat = chatmanager.createChat("lion@example.com",
42                     new MessageListener() {
43                         public void processMessage(Chat chat, Message message) {
44                             System.out.println("I'm sending: "
45                                     + message.getBody());
46                         }
47                     });
48             newChat.sendMessage("hi");
49         } catch (XMPPException e) {
50             e.printStackTrace();
51         } finally {
52             // 让线程休眠 然后再关闭连接
53             Thread.sleep(20000);
54             con.disconnect();
55         }
56     }
57 
58     private static void addListener() {
59         // 包的过滤器
60         PacketFilter filterMessage = new PacketTypeFilter(Message.class);
61         // 创建包的监听器
62         PacketListener myListener = new PacketListener() {
63             public void processPacket(Packet packet) {
64                 // 以XML格式输出接收到的消息
65                 System.out.println(packet.toXML());
66                 System.out.println("From: " + packet.getFrom() + "n");
67                 System.out.println("Body: " + ((Message) packet).getBody());
68 
69                 try {
70                     // 尝试发送消息给服务器
71                     newChat.sendMessage("hi again");
72                 } catch (XMPPException e) {
73                     e.printStackTrace();
74                 }
75             }
76         };
77         // 给连接注册一个包的监听器
78         con.addPacketListener(myListener, filterMessage);
79     }
80 }

摘要XMPP开源IM客户端Spark在2017新年初发布了2.8.3版,该版本是个次要更新版,修复了bug并新增了若干新特性。前言XMPP开源IM客户端Spark在2017新年初发布了2.8.3版,该版本是个次要更新版,修复了bug并新增了若干新特性。Spark是一个开源、跨平台IM客户端(支持Linux、windows、Mac OS X平台)。它的特性支持集组聊天,电话集成和强大安全性能。如果企业内部部署IM使用Openfire+Spark是最佳的组合。官方的说明原文The Ignite Realtime community has just released Spark 2.8.3 and it can be downloaded from theIgnite Realtime: DownloadsThis is a regular update. A few issues have been fixed. Bundled Java updated to the latest version. There is a new menu to view history of sent broadcasts and an option to login anonymously.For a complete list of changes please check theSpark ChangelogWe encourage developers to get involved with Spark project by providing feedback and patches in the forums or submitting pull requests toGitHub - igniterealtime/Spark: Cross-platform real-time collaboration client optimized for business and organizations.Here is the list of contributors to this release (besides myself):Michael - fixed Advanced settings not being saved without opening that menu, always on top issue and changed behavior when Auto Login is hiddenAlexander198961 (Aleksander Kovtunenko) · GitHub - added a feature to save broadcasts history and access it via a new menu optionJerry - added support for anonymous loginGuus der Kinderen - fixed issue when joining a room with a duplicate nickname and improved build time by removing unneeded code style checksDaryl Herzmann - helped to clean up the code further (removing legacy CVS keywords)speedy - fixed issues with password not being deleted when it should and added log file rotating by sizeAtalanttore (Ettore Atalan) · GitHub - updated German translation(官方原文: 版更新内容Bug[SPARK-1844] - Not saving settings without opening Advanced menu once[SPARK-1848] - Setting "Chat Window Always on Top" also enables "Main Window Always on Top" behavior[SPARK-1853] - NPE when not setting an avatar[SPARK-1854] - Joining a MUC with a duplicate nickname results in strange behavior.[SPARK-1855] - ContactList should not pop up when logging off[SPARK-1858] - Password not removed from spark.properties when "Save Password" option is disabled[SPARK-1863] - Resets initially empty values in Advanced menu when logging outNew Feature[SPARK-1825] - Add an option to see a history of broadcasts[SPARK-1852] - Add anonymous SASL login supportTask[SPARK-1821] - Update bundled JRE with the latest version[SPARK-1856] - Remove unused static analyzers[SPARK-1857] - Remove legacy CVS keywords[SPARK-1862] - Remove obsolete information from Readme and update linksImprovement[SPARK-1847] - Remove Log out menu when Auto Login and Save Password are disabled[SPARK-1849] - Make logs rotate based on size or time[SPARK-1850] - Shouldn't save password when SSO is being used[SPARK-1860] - Implement group chat duplicate name deconfliction similar to 2.7.7[SPARK-1864] - Add translations to MUC dialogs[SPARK-1867] - Update German translation更多版本更新记录,请参见:

最近项目会用到openfire相关的知识,前期进行了相关的学习,整理为以下笔记。这篇主要是记录openfire服务器的搭建。

  • PubSubManager.getLeafNode() throws PubSubAssertionError.DiscoInfoNodeAssertionError if node exists but its not a PubSub Node[SMACK-814] - NPE when using Node.getAffiliationsAsOwner()[SMACK-815] - XEP-0184: DeliveryReceipt requires ID, although the XEP defines it as optional attribute[SMACK-818] - EntityCapsManager sends presences with multiple CapsExtension causing disco#info lookup to fail[SMACK-819] - ConcurrentModification Exception in MultiUserChatManager.java[SMACK-820] - DNSUtil.setDaneProvider() does not set the DANE providerTask[SMACK-769] - Rename XMPPError to StanzaError[SMACK-776] - Remove deprecated reconnection callbacks in ConnectionListenerImprovement[SMACK-761] - Adopt ChatStateManager to new Chat API (chat2)[SMACK-812] - Enable ModifierOrder checkstyle check[SMACK-816] - SimplePayload should infer the XML element name and namespace详见官方博客:

一、基础知识(这是复制别人的)

  澳门新浦京娱乐游戏 1

Mac下openfire服务器的卸载

  • 使用官方openfirre的mac安装包时,会把openfire安装在/usr/local/openfire目录下。

    并且配置启动项:/Library/LaunchDaemons/org.jivesoftware.openfire.plist

    以及系统控制面板:/Library/PreferencePanes/Openfire.prefPane

    只需要在openfire关闭的情况下,执行以下的命令即可:

    sudo rm-rf/Library/PreferencePanes/Openfire.prefPane

    sudo rm -rf /usr/local/openfire

    sudo rm-rf/Library/LaunchDaemons/org.jivesoftware.openfire.plist

XMPP协议简介

XMPP协议(Extensible Messaging and PresenceProtocol,可扩展消息处理现场协议)是一种基于XML的协议,目的是为了解决及时通信标准而提出来的,最早是在Jabber上实现的。它继承了在XML环境中灵活的发展性。因此,基于XMPP的应用具有超强的可扩展性。并且XML很易穿过防火墙,所以用XMPP构建的应用不易受到防火墙的阻碍。利用XMPP作为通用的传输机制,不同组织内的不同应用都可以进行有效的通信。

这篇文章有基本的介绍,

转载请说明出处:

XMPP协议简介

  • XMPP协议(Extensible Messaging and PresenceProtocol,可扩展消息处理现场协议)是一种基于XML的协议,目的是为了解决及时通信标准而提出来的,最早是在Jabber上实现的。它继承了在XML环境中灵活的发展性。因此,基于XMPP的应用具有超强的可扩展性。并且XML很易穿过防火墙,所以用XMPP构建的应用不易受到防火墙的阻碍。利用XMPP作为通用的传输机制,不同组织内的不同应用都可以进行有效的通信。

  • 想了解更多可以看 XMPP协议分析-原理篇