Implementation of the sending language function of IM based on XMPP

Source: Internet
Author: User

In the development of real-time communication system based on XMPP protocol, it is necessary to send the language, in general we have two kinds of solutions,

1. Use the HTTP transport, transfer the recorded language file to the server, then generate the file directory, obtain the directory when another client requests it, and then download the voice file.

2. Encode the recorded voice using BASE64 encoding, then transfer the encoded result string as a normal text message, and client B is then removed from the server to decode

Base64 is one of the most common encoding for transmitting 8bit bytes of data on the network, and it can transmit longer identity information in an HTTP environment. Use of the environment, in the language chat, the longest can only record 60 seconds of language (also so designed), its size is about 20K, cooked words to kill chicken with slaughter sledgehammer, the use of file mode transmission will appear clumsy, and we change a method, the use of character transmission, directly encoded string as the message content transmission, This eliminates the work of the service side and makes full use of the XMPP protocol.

Implementation of the sending language function of IM based on XMPP

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.