公司的APP最新要做用户建议和bug反馈功能,需求是我们的运营人员能对用户反馈和建议进行沟通交流。做调研和向之前的同事和网友咨询相关经验后决定使用基于Apache Licene2.0开源协议的openfire4.2+的IM聊天服务器。
openfire和spark的安装很简单,网上一堆教程,这次就不多说了。
安装成功后,openfire后台是这个样子的:
假如要实现类似客服系统的话,需要安装一个openfire的插件----Fastpath(仔细看上图),Fastpath插件安装同样很简单傻瓜式安装,在openfire后台导航选择“插件----有效插件”然后选择“fastpath”,点击安装即可。
重点来了!!!fastpath server的web端fastpath webchat插件就比较难了,本章重点介绍如何安装webchat。
网上说的webchat.war已经下载不了了,别费劲找了。下面是webchat源码的下载地址https://codeload.github.com/igniterealtime/Fastpath-webchat/zip/master
使用idea的同学可以直接部署,eclipse的需要做以下修改,步骤:
新建一个web项目,把源码中src目录下java目录的java代码、webapp目录下的jsp、webapp/WEB-INF下的lib中的jar包和dwr.xml、taglibs-mailer.tld、web.xml配置文件放到新建的web项目下,即可。请忽略plugin目录。
eclispe编译后,启动tomcat,访问http://localhost:8080/webchat,进入如下页面:
Server Host输入你自己openfire部署服务器的ip,点击save按钮,可能会报:
异常,这时要加入下面几个jar包,可自行百度下载:
javax.servlet.jsp-api-2.3.1.jar
jasper-compiler-jdt-5.5.15.jar
jasper-compiler.jar
jasper-el.jar
jasper-jdt.jar
jasper-runtime.jar
jasper.jar
加入后重启,点击save按钮可能还会报错:Anonymous login test failed. Ensure that anonymous logins are enabled on the
这时去openfire的后台:服务器---服务器设置----登录和注册,把匿名登录设置开启。
不出意外的话会配置成功,进入如下页面:
click on the fllowing image:
这时页面上没有workgroup的图标并且查看log会发现已经报错:
警告: Could not retrieve image: offline
remote-server-not-found(404)
at org.jivesoftware.smackx.workgroup.user.Workgroup.getChatSettings(Workgroup.java:687)
at org.jivesoftware.smackx.workgroup.user.Workgroup.getChatSettings(Workgroup.java:654)
at org.jivesoftware.webchat.util.SettingsManager.getImage(SettingsManager.java:147)
at org.jivesoftware.webchat.FastpathServlet.service(FastpathServlet.java:174)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.jivesoftware.webchat.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:45)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.jivesoftware.webchat.SetupFilter.doFilter(SetupFilter.java:92)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
然后点击图标就可以进行对话了,我的客户端用的是spark,会随机匹配一个客服对话。
把webchat部署之后,访问:http://localhost:8080/webchat/页面查看workgroup列表,如果这时只两句话,并没有图标:
List of available workgroups within Fastpath Click on one of the following workgroups to join.
<此处应有workgroup组图标>
|
2,Form UI:主要是用户网页端连接时需要输入的个人信息内容,可以自行修改
3,Images:用来修改网页端对话窗口的各种图标
4,text:用来修改网页端对话窗口的各种文本提示
5,offlien settings:用来设置客服全不在线时的动作
6,transcripts:用来设置对话结束后给用户发送一份聊天副本