基于XMPP的即时通信系统的建立(五)— openfire

本文详细介绍了如何使用Openfire作为即时通讯服务端的搭建过程,包括数据库配置、服务端启动及配置,并展示了如何使用Spark客户端进行用户注册与登录。

现决定使用Openfire作为服务端,Openfire采用Java开发,基于XMPP的实时开源协作服务器。单台可支持上万并发用户。

Openfire体系结构

Openfire体系由其提供的服务器端、客户端以及相应的开发库组成。

 

Openfire

通常我们所说的Openfire就是指Openfire服务端,现在已经更新到3.10.3版本,该服务器实现了绝大部分的XMPP协议。

除此之外,还有大量的Openfire插件可供使用。

Spark

Spark是一个使用java开发的实时协作客户端,通过简单的配置和注册即可使用。

Smack

Smack is a client library. You can use it to log into an XMPP domain and make use of the functionality it provides. Typically, Smack is used to implement an instant messaging client。

Tinder

Tinder is a low-level XMPP library. It provides Java implementations of basic XMPP entities, such as Stanzas (called 'Packet' in XMPP), JIDs and Components (which typically implement part of the functionality of an XMPP server). Although in theory, Tinder could be used to implement client functionality, it currently is primarily used on the server-side. Both Whack and Openfire (an XMPP server implementation) use Tinder-defined entities. Smack does not use Tinder at all.

Whack

Whack is Java library that is used to implement external components. Whack allows a Component (as defined in Tinder) to run as a stand-alone process. Whack allows you to connect this process to an XMPP domain. This way, you can extend the functionality provided by that domain without modifying the implementation of the server software.

服务端搭建

安装数据库

  1. 安装客户端

  rmp –ivh MySQL-client-5.6.21-1.linux_glibc2.5.x86_64.rpm

  (注)如果提示冲突,需要运行yum –y remove ${APP}卸载冲突软件

  2. 安装服务端

  rmp –ivh MySQL-server-5.6.21-1.linux_glibc2.5.x86_64.rpm

  3. 数据库配置

  3.1设置本地登录账号

    mysql –u root -p

    set password for root@localhost=password('jiyq');

    如果主机名其他,例如jiyq,需要将localhost改为jiyq

    set password for root@jiyq=password('jiyq');

  3.2切换数据库

    use mysql;

  3.3设置网络连接账户

    Grant all privileges on *.* to 'root'@'%' identified by 'jiyq' with grant option;

  3.4 更新账户权限

    FLUSH PRIVILEGES; 

  3.5 打开防火墙3306端口

    iptables -A INPUT -p tcp --dport 3306 -j ACCEPT

    iptables -A OUTPUT -p tcp --sport 3306 -j ACCEPT

    service iptables save

  3.7 创建数据库

    create database openfire

  3.8 运行建表语句

    在openfire数据库下,运行/opt/openfire/resources/database/openfire_mysql.sql

安装服务端

  1. 解压openfire_3_10_3.zip到/opt目录下

  2. 启动openfire

  /opt/openfire/bin

  ./openfire start

  3. 访问配置页面

  http://192.168.189.131:9090/setup/index.jsp

  4. 配置语言

   

  5. 服务器设置

   

  6. 数据库设置

   

  7. 数据库设置-标准连接

   

  8. 特性设置

   

  9. 管理员账户

   

  8. 安装完成

   

客户端搭建

这里使用Spark作为PC端的客户端。

  1. 安装Spark

    这里采用spark_2_7_3_online.exe版本

  2. 注册用户

     

  3. 登录客户端

     

转载于:https://www.cnblogs.com/jiyuqi/p/5086165.html

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符  | 博主筛选后可见
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值