Persistent http connection from Java server

2019-06-09 16:03发布

I want to create a persistent connection between Java spring server and Android client.

What I need is sort of a push mechanism with a persistent (long-lived HTTP) connection that will stream all the information from server to the client once they are available.

Are there any available frameworks that would support that, Java Spring preferably. Tutorials or documents that will help me implementing this.

2条回答
劫难
2楼-- · 2019-06-09 16:28

Well you can start here to learn about the general ways to accomplish that.

Some example technologies are:

查看更多
混吃等死
3楼-- · 2019-06-09 16:38

Long-lived HTTP connections and WebSockets are generally more suited to web apps when it comes to 'push'.

If you don't mind some work on the server side, a persistent socket is definitely the most battery friendly way.

Here's a good start: http://devtcg.blogspot.com/2009/01/push-services-implementing-persistent.html

查看更多
登录 后发表回答