============ Problem Description ============
To do an Android project recently, need to be related to the function of the network has
1, Live Chat
2, upload pictures, videos
With these two typical functions,
do you want to use the socket or HTTP? Shun be popular for the use of the two scenarios (don't just say the difference)
。。。。
Background
Familiar with socket programming, and have used the XMPP protocol to write Instant messaging tools.
============ Solution 1============
You go to see the source of Amask to understand, remember is the socket implementation of the long connection, the transmission of chat data, including text image voice
and Beem this project, is to use the amask, but only to achieve the text chat
============ Solution 2============
For my personal use, the socket is generally used to compare real-time communication and high-performance situations, such as push, chat, keep the heartbeat long connection, HTTP is generally used for real-time requirements are not so high situation, such as information feedback, image upload, access to news information.
============ Solution 3============
Reference 3 floor Chziroy's reply:
Quote: Quote 2 floor Lionfresh reply:
For my personal use, the socket is generally used to compare real-time communication and high-performance situations, such as push, chat, keep the heartbeat long connection, HTTP is generally used for real-time requirements are not so high situation, such as information feedback, image upload, access to news information.
Then whether I use a server, and then according to the type of request, chat information with the socket, upload, download the image is http.?
That's what I'm doing right now.
Usage scenarios for HTTP and sockets