0

Purpose: I'm trying to make a real-time web service in Java. When there're changes in database, the data in clients(probably Android client) will be changed automatically without refreshing.

Platform: I'm using Tomcat 7 container and Axis2.

Problems: I'm stuck in the way to approach. I've realized that there were 2 ways: 1. When the data in server changes, notice to all the clients. Web-service allows us to do this, but I don't know what clients I have to inform! 2. Clients connect to the server, keep the connection alive and whenever there's a change, update data. However, if the client is the handheld, it will consume much power and data exchange over 3G network.

I know that's a complicated problem. So I just want to ask if there is an efficient way to approach? And if possible, anyone can give me one example of realtime web service like this? I've searched over many pages, but nothing's helpful. Can anyone give me some suggestions? Tkx!

4

1 回答 1

1

是否需要使用 Web 服务或 Axis?否则,您可能会对WebSockets感兴趣。这些是通过普通 HTTP 的连接,提供两种方式的通信。您的客户端将连接到您的服务器,一旦有新数据可用,您的服务器就可以将数据推送到它知道的每个连接,从而通知所有连接的客户端。

于 2013-03-24T11:20:56.557 回答