admin管理员组文章数量:1332896
Do I create a timer that does ajax requests every so often to check for new messages? This seems like it would be a huge drain on the phone.
What would be the best way to create a simple PhoneGap instant messaging/chat app?
Is HTTP streaming a tenable strategy for mobile devices? What if the connection is interrupted? Does it work on 3G?
Obviously this is a big question but any help would be much appreciated.
Do I create a timer that does ajax requests every so often to check for new messages? This seems like it would be a huge drain on the phone.
What would be the best way to create a simple PhoneGap instant messaging/chat app?
Is HTTP streaming a tenable strategy for mobile devices? What if the connection is interrupted? Does it work on 3G?
Obviously this is a big question but any help would be much appreciated.
Share Improve this question edited May 5, 2012 at 16:19 Jeff LaFay 13.4k14 gold badges73 silver badges102 bronze badges asked Dec 22, 2011 at 20:48 JustinJustin 3,6343 gold badges29 silver badges39 bronze badges1 Answer
Reset to default 6This question is a little high level in scope and a lot would go into a "total answer". It depends on what you're using but have you considered using node.js and websockets? I know there are other ways to do server side websockets but that is a popular one.
If you're not familiar with web sockets, it's a new HTML5 technology and the mobile platforms seem to be keeping right along with HTML5 technologies so this may be a viable solution for you if you're still looking for something.
The thing with web sockets is that you don't poll for new data as what you have speculated in your question. It maintains an open connection between the server and the client. That way, the server only needs to push new data to the client when it arrives and vice versa when you want to push data to the server. You use a lot less data and processing since you don't periodically check for data. Also it's more of a "realtime" experience since messages are propagated after the server receives them.
Doing a general google search for websockets
and chat
yield all kinds of tutorials available.
Hope that helps.
本文标签: javascriptcreating a mobile chat app with phonegapbest strategyStack Overflow
版权声明:本文标题:javascript - creating a mobile chat app with phonegap - best strategy? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742308977a2450485.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论