chat application on appengine

こ雲淡風輕ζ 提交于 2019-12-22 18:27:26

问题


I am willing to implement a chat website on App Engine. But I found that App Engine will not allow me to go with server push. (as it will kill the response after 30 sec).

  1. So whats the other method that can be used? Will polling cause bad user experience? Meaning will the user have to wait for some time to retrieve new messages from the server?

  2. What will be the ideal polling interval?

  3. If you use very small polling intervals, will my bandwidth get exhausted? Will I suffer performance problems?


回答1:


This is a quite old question now, but I was looking for a similar answer. I think the Channel API (http://code.google.com/appengine/docs/java/channel/) is much better suited for the task. For what I understand, XMPP is good to interact with the app, but not with other users. Channel API implement push notifications via HttpRequest. I just found an example of a chat room here: https://bitbucket.org/keakon/channelchat




回答2:


Can't you just use XMPP instead of a website? It would be a much better approach. Polling certainly isn't going to scale very well and will definitely not give a good user experience.

XMPP with appengine




回答3:


I've heard of people working around that by holding the connection (i.e. sending no response) until it dies then reestablishing it. 30 seconds is not that much though.

If done this way it would still feel more responsive to the user than polling every 30 secs.

About the bandwith usage: Depending on the payload "typical" HTTP requests can range from a few hundred bytes to some kBytes especially with cookies.

With an average size of let's say 5kB (pessimistic) every 30 sec that would sum up to around 14 MB per 24 hrs. Maybe you can cut down the size by setting a path in your cookies so they don't get send for these connections. Maybe you don't need to send the whole payload again every 30 secs.




回答4:


yeah channel api is the best solution, with gwt is even better

http://www.dev-articles.com/article/Google-App-Engine-sending-messages-with-XMPP-393002



来源:https://stackoverflow.com/questions/2507620/chat-application-on-appengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!