Interpretation of new capabilities of applet development - 2021.09

binnie 2021-09-15 09:55:33

The official account is from WeChat “ Wechat developers ”:

1. Jump interface of video Number

Introduce : Better understand the services provided by the applet through the introduction of live video number and video content . It can be broadcast live on e-commerce 、 Application scenarios such as content marketing are better linked with video numbers .

Jump to the live video room

wx.getChannelsLiveInfo: Get live video information , adopt Video Number id You can get the live broadcast feedId、 live broadcast nonceId And so on

wx.openChannelsLive: Turn on the live video , adopt Video Number id、 live broadcast feedId、 live broadcast nonceId When you turn on the live broadcast

Initiate an appointment for live broadcast of the video Number

wx.getChannelsLiveNoticeInfo: Get the live broadcast preview information of the video Number , adopt Video Number id You can get Notice id And so on

wx.reserveChannelsLive: Make an appointment for the live broadcast of the video number , adopt Notice id Reservation live broadcast

Click to view the complete official document of the applet jump to the video Number

2. Safety capability - The applet encrypts the network channel

Introduce : In order to prevent the data from being intercepted and tampered when the applet communicates with the developer background , The wechat side maintains a reliable user dimension key, It is used for encryption and signature when small programs communicate with the background .

Developers can use the interfaces provided by the applet front end and wechat background respectively , Get the user's encryption key.

Usage method

  1. Front end by userCryptoManager.getLatestUserKey Get encryption key information
  2. launch wx.request When requesting, use the encryption key information obtained in the first step to encrypt the parameters
  3. Server request server interface getUserEncryptKey Get encryptKey Used to decrypt

Sample code

// front end
const somedata = 'xxxxx'
const userCryptoManager = wx.getUserCryptoManager()
success({encryptKey, iv, version, expireTime}) {
const encryptedData = someAESEncryptMethod(encryptKey, iv, somedata)
data: encryptedData,
success(res) {
const decryptedData = someAESDEcryptMethod(encryptKey, iv,
// Server side
curl -X POST ""

Click to view the complete official document of applet encryption network channel

3. Safety capability - Security keyboard

Introduce : In order to improve the ecological security of wechat open platform , For the possible security problems in the scenario of digital password input in the applet , Wechat side is input Component opens the security keyboard type . The secure keyboard capability enables encryption when users enter key information , Prevent network listening 、 Trojan virus and other means to steal information .


  1. Through wechat Tools Generate CS
  2. In the background of applet Management 「 Development 」-「 Development management 」-「 Development and setup 」-「 Secure keyboard certificate 」 The plate is filled with CSR Generate Certificate
  3. Put the generated certificate into the applet code package
  4. input Set up type=“safe-password”, And set relevant parameters safe-password-* You can use
  5. input bindblur obtain encryptedValue, After the server gets the data, it can decrypt it with the private key

Sample code

style="border: 1px solid blue;"
safe-password-custom-hash="md5(sha1('foo' + sha256(sm3(password + 'bar'))))"

Click to view the complete official document of the security keyboard

4. TCP Communication capability wx.createTCPSocket

Use scenarios

  1. Internet of things hardware wifi Distribution network
  2. Security surveillance camera X-P2P live broadcast
  3. LAN TCP Communications

Click to see TCP Complete official documentation of communication capabilities

5. newly added wx.createWebAudioContext Interface

Introduce : Different from the original wx.createInnerAudioContext Interface ,wx.createWebAudioContext Many interfaces are provided for processing transformed audio .

Use scenarios

  1. Add special effects to audio
  2. Visualize audio
  3. Add space effects ( Such as translation )

Click to see wx.createWebAudioContext Complete official documentation

6. File system added FD Related interfaces

Introduce : Provide file system FD Related interfaces , So that developers can more atomically 、 Higher performance operation files .

Related interfaces / openSync : Open file

FileSystemManager.close / closeSync : Close file

FileSystemManager.fstat / fstatSync : Get the status information of the file

FileSystemManager.write / writeSync : write file / readSync : Reading documents

FileSystemManager.ftruncate / ftruncateSync : truncate file

7. Mobile analytics HttpDNS

Introduce : Developers call wx.request when , Mobile resolution can be enabled HttpDNS service . The service is based on Http Agreement to the service provider DNS Server sends domain name resolution request , Instead of based on DNS Agreement to operator Local DNS The traditional way to initiate resolution requests , You can avoid Local DNS Caused by domain name hijacking and cross network access , Solve the problems caused by abnormal domain name resolution in mobile Internet services .


  1. Go to Wechat service platform Choose HttpDNS resources , And on the service details page - Access the document to get Service ID
  2. Applet call wx.request, take enableHttpDNS Parameter set to true, And in httpDNSServiceId Fill in the selected service provider in the parameters Service ID

Sample code

url: 'example.php', // Just for the sample , Not a real interface address
enableHttpDNS: true,
httpDNSServiceId: 'wxa410372c837a5f26',
success(res) {
console.log('request success', res)
fail(res) {
console.error('request fail', res)

View mobile resolution HttpDNS Complete official documentation

8. More capabilities

  • WXWebAssembly details
  • Subscribe to message voice reminders details
  • Expand UDP Interface , increase setTTL Interface details
  • License plate interface - Select the license plate number wx.chooseLicensePlate details
  • The applet opens wechat customer service wx.openCustomerServiceChat details

If there are other problems related to applet development , Please go to   Wechat open community   Post interaction , The technical specialist will communicate with you and answer .

Link to the original text :

Please bring the original link to reprint ,thank
Similar articles