WeChat public platform development (3): WeChat public platform

Source: Internet
Author: User
Tags openid website server

Public platform development (III): Public Platform

1. Public platform message interaction process

As developers, we have two main targets: servers and application (website) servers.

When a user sends a message to your public platform, the message is actually sent to the server first. The server initiates another request to the website server, and the website server returns the result of this request, then the server sends it to the client.

The entire message communication process is as follows:

In the above five steps, as developers, we focus mainly on step 3, which actually requires three tasks:

I will describe the above three tasks in detail and provide a complete set of simple and efficient processing methods.

XML format of forwarded messages

<? Xml version = "1.0" encoding = "UTF-8"?> <Xml> <ToUserName> <! [CDATA [gh_a96a4a619366]> </ToUserName> <FromUserName> <! [CDATA [olPjZjsXuQPJoV0HlruZkNzKc91E]> </FromUserName> <CreateTime> 1357986928 </CreateTime> <MsgType> <! [CDATA [text]> </MsgType> <Content> <! </Content> <MsgId> 5832509444155992350 </MsgId> </xml>

The official description of the corresponding node is as follows:

Parameters Description
ToUserName Developer ID
FromUserName Sender account (one OpenID)
CreateTime Message creation time (integer)
MsgType Text
Content Text message content
MsgId Message id, 64-bit integer

 

 

 

 

 

 

XML format of returned messages

<? Xml version = "1.0" encoding = "UTF-8"?> <Xml> <ToUserName> <! [CDATA [olPjZjsXuQPJoV0HlruZkNzKc91E]> </ToUserName> <FromUserName> <! [CDATA [gh_a96a4a619366]> </FromUserName> <CreateTime> 63497820384 </CreateTime> <MsgType> text </MsgType> <Content> <! [CDATA [text message you just sent: Chinese // You can also send [location] [Image] [Voice] information to view replies in different formats. // SDK official address: http://weixin.senparc.com]> </Content> </xml>

The official description of the corresponding node is as follows:

Parameters Description
ToUserName Recipient account (received OpenID)
FromUserName Developer ID
CreateTime Message Creation Time
MsgType Text
Content The content of the reply message. The length cannot exceed 2048 bytes.
FuncFlag The message received by the star when 0x0001 is marked.

 

 

 

 

 

 

 

Some issues that need attention and are easily overlooked:

 

WeiXinMessageSDK source code download case source code

Related Article

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.