Usage scenarios for HTTP and sockets

Source: Internet
Author: User
Tags live chat

============ 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.