openfire

Android 消息推送流程机制

最后都变了- 提交于 2019-12-30 04:29:40
   1.引言   所谓的消息推送就是从服务器端向移动终端发送连接,传输一定的信息。比如一些新闻客户端,每隔一段时间收到一条或者多条通知,这就是从服务器端传来的推送消息;还比如常用的一些IM软件如微信、GTalk等,都具有服务器推送功能。   推送方法如下:   1)通过SMS进行服务器端和客户端的交流通信。   在Android平台上,你可以通过拦截SMS消息并且解析消息内容来了解服务器的意图,可以实现完全的实时操作。但是问题是这个方案的成本相对比较高,且依赖于运营商。   2)循环主动定时获取   这种方法需要客户端来做一个定时或者周期性的访问服务器端接口,以获得最新的消息。轮询的频率太慢可能导致某些消息的延迟,太快则会大量消耗网络带宽和电池。   3)持久连接   这个方案可以解决由轮询带来的性能问题,但是还是会消耗手机的电池。我们需要开一个服务来保持和服务器端的持久连接(苹果就和谷歌的C2DM是这种机制)。但是对于Android系统,当系统可用资源较低,系统会强制关闭我们的服务或者是应用,这种情况下连接会强制中断。(Apple的推送服务之所以工作的很好,是因为每一台手机仅仅保持一个与服务器之间的连接,事实上C2DM也是这么工作的。即所有的推送服务都是经由一个代理服务器完成的,这种情况下只需要和一台服务器保持持久连接即可。C2DM= Cloud to Device

Android消息推送

删除回忆录丶 提交于 2019-12-30 04:25:52
1. 引言   所谓的消息推送就是从服务器端向移动终端发送连接,传输一定的信息。比如一些新闻客户端,每隔一段时间收到一条或者多条通知,这就是从服务器端传来的推送消息;还比如常用的一些IM软件如微信、GTalk等,都具有服务器推送功能。   推送方法如下:   1)通过SMS进行服务器端和客户端的交流通信。   在Android平台上,你可以通过拦截SMS消息并且解析消息内容来了解服务器的意图,可以实现完全的实时操作。但是问题是这个方案的成本相对比较高,且依赖于运营商。   2)循环主动定时获取   这种方法需要客户端来做一个定时或者周期性的访问服务器端接口,以获得最新的消息。轮询的频率太慢可能导致某些消息的延迟,太快则会大量消耗网络带宽和电池。   3)持久连接   这个方案可以解决由轮询带来的性能问题,但是还是会消耗手机的电池。我们需要开一个服务来保持和服务器端的持久连接(苹果就和谷歌的C2DM是这种机制)。但是对于Android系统,当系统可用资源较低,系统会强制关闭我们的服务或者是应用,这种情况下连接会强制中断。(Apple的推送服务之所以工作的很好,是因为每一台手机仅仅保持一个与服务器之间的连接,事实上C2DM也是这么工作的。即所有的推送服务都是经由一个代理服务器完成的,这种情况下只需要和一台服务器保持持久连接即可。C2DM= Cloud to Device

How to retrieve chat history from open fire in android

北城余情 提交于 2019-12-30 03:33:06
问题 I have a chat app in which I want to retrieve chat history between two users, I have a stanza for retrieving chat messages and that is... <iq type='get' id='pk1'> <list xmlns='urn:xmpp:archive' with='shrey27@sys1-pc'> <set xmlns='http://jabber.org/protocol/rsm'> <max>30</max> </set> </list> </iq> now, my problem is how can I fire this stanza to the server so that I can get the response.I have installed the message archiving plugin and messages are getting stored perfectly.any suggestions

Getting all users from an openfire server using smack android

≡放荡痞女 提交于 2019-12-29 08:22:26
问题 i have a openfire server running on my localhost and i am successfully able to send and receive messages to registered users. however i am not been able to get all users from server. i am logged in with user that doesn't have a administration access. so do i need to give any permission on server side? The code i am using for getting all users is.. if ( xmpp.getConnection()== null || !xmpp.getConnection().isConnected()) return; try { UserSearchManager usm = new UserSearchManager(xmpp

ubuntu下设置开机自启动项

浪子不回头ぞ 提交于 2019-12-27 17:50:28
这里说明, Ubuntu 中系统没有了 RH 系统中的 chkconfig 命令 ! 可用一些小工具来管理 Ubuntu 的启动选项: 小工具 rcconf : #sudo apt-get rcconf #sudo apt-get install rcconf root 下运行: #sudo rcconf 功能更全的工具 : sysv-rc-conf #sudo apt-get update #sudo apt-get install sysv-rc-conf 运行: #sudo sysv-rc-conf 也可以直接加入启动程序,例如把 /etc/init.d/red5 加入到系统自动启动列表中: #sudo sysv-rc-conf red5 on 其他使用方法见: google::Ubuntu::sysv-rc-conf 命令用法 也可以直接修改 直接改 /etc/rc0.d ~ /etc/rc6.d 和 /etc/rcS.d 下的东西, S 开头的表示启动, K 开头的表示不启动, 例如:想关闭 Red5 的开机自动启动,只需 #sudo mv /etc/rc2.d/S20red5 /etc/rc2.d/K20red5 就可以了。 Ubuntu自动启动程序 首 先,linux随机启动的服务程序都在/etc/init.d这个文件夹里,里面的文件全部都是脚本文件

Android推送通知指南

孤人 提交于 2019-12-25 15:51:53
在开发Android和iPhone应用程序时,我们往往需要从服务器不定的向手机客户端即时推送各种通知消息,iPhone上已经有了比较简单的和完美的推送通知解决方案,可是Android平台上实现起来却相对比较麻烦,最近利用几天的时间对Android的推送通知服务进行初步的研究。 在Android手机平台上,Google提供了C2DM(Cloudto Device Messaging)服务,起初我就是准备采用这个服务来实现自己手机上的推送功能。 Android Cloud to Device Messaging (C2DM)是一个用来帮助开发者从服务器向Android应用程序发送数据的服务。该服务提供了一个简单的、轻量级的机制,允许服务器可以通知移动应用程序直接与服务器进行通信,以便于从服务器获取应用程序更新和用户数据。C2DM服务负责处理诸如消息排队等事务并向运行于目标设备上的应用程序分发这些消息。 但是经过一番研究发现,这个服务存在很大的问题: 1)C2DM内置于Android的2.2系统上,无法兼容老的1.6到2.1系统; 2)C2DM需要依赖于Google官方提供的C2DM服务器,由于国内的网络环境,这个服务经常不可用,如果想要很好的使用,我们的App Server必须也在国外,这个恐怕不是每个开发者都能够实现的; 有了上述两个使用上的制约,导致我最终放弃了这个方案

Android Smack MessageEventManager not compiling

拜拜、爱过 提交于 2019-12-25 04:39:37
问题 I am using smack API with openfire server to make an android app. I am trying to implement a MessageEventManager and MessageEventProvider to my app so it will tell me if the message was delivered or not though when i try to declare it a MessageEventManager, it is not compiling and tells me to create that class, What can i do? i have the following dependencies in my gradle: dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:22.1.1'

XMPP: count of unread messages

二次信任 提交于 2019-12-25 04:16:03
问题 I'm trying to implement chat for my webapp with following features: When user logs in he should see a number of unread messages (which is both offline messages and "unseen", I will explain "unseen" in next step). When user is anywhere in the app but on chat window he should be notified that he has a new message. Message should be marked "unseen" and must be added to the count of unread messages. The first point is quite easily achieved using XEP-0013: Flexible Offline Message Retrieval. So I

File transfer in group chat with XMPP

霸气de小男生 提交于 2019-12-25 02:38:17
问题 I am using group chat with open fire. i can able to send messages but how to send file to group with Smack library. i can able to send file to single user with below but i don't know how to send to group chat (MUC) so all users in room will receive that file OutgoingFileTransfer transfer = manager.createOutgoingFileTransfer("usre2@myHost/Smack"); 回答1: Use XEP-0066: Out of Band Data - this is small extension to standard groupchat message with url and description. Other users will receive link

JavaScript/jQuery、HTML、CSS 构建 Web IM 远程及时聊天通信程序

核能气质少年 提交于 2019-12-24 20:15:26
这篇文章主要介绍用JavaScript和jQuery、HTML、CSS以及用第三方聊天JavaScript(jsjac)框架构建一个BS Web的聊天应用程序。此程序可以和所有连接到Openfire服务器的应用进行通信、发送消息。如果要运行本程序还需要一个聊天服务器Openfire, 以及需要用到Http方式和Openfire通信的第三方库(JabberHTTPBind)。 JabberHTTPBind是jabber提供的XMPP协议通信的Http bind发送的形式,它可以完成WebBrowser和Openfire建立长连接通信。 主要通信流程如下图所示: 用户A通过JavaScript jsjac.js库发送一条消息到JabberHTTPBind这个Servlet容器,然后JabberHTTPBind的Servlet容器会向Openfire发送XMPP协议的XML报文。Openfire Server接收到报文后解析,然后发送给指定的用户B。JabberHTTPBind获取到Openfire Server发送的数据后,解析报文向当前Servlet容器中的链接的Session中找到指定的用户再发送数据给用户B。 WebBrowser端用的是jsjac和JabberHTTPBind建立的连接,所有数据都要经过JabberHTTPBind解析/转换发送给Openfire。