Table of contents
question image
Send a websocket request, the returned websocket data is incorrect
problem causes
Obtaining the openid interface The js_code in the interface address is uname
when obtaining the openid - the reason
- When sending a websocket request, the passed uname is the login credential
Taro.login()
obtainedcode
, and the uname (that is, code)openid
is used to - However, the appid of the applet configured by the current WeChat developer tool is inconsistent with the wxappid in the sent websocket → the obtained code is taken from the appid configured by the WeChat developer tool, and the two do not match
- So get openid request failed
solve
微信开发者工具配置的 小程序 appid
Change it to be the same as the wxappid carried when sending websocket