Solution to the problem that the wss/ws setting of WebSocket in the WeChat applet requesting a legal domain name reports an error that the protocol header of the domain name is illegal

The WeChat applet does not support directly using the wss:// format to set the domain name
Insert image description here
, but in fact we can use a delaying strategy.
Here we directly change it to https
Insert image description here
and then we connect through wss://ws-api.turingapi.com/api/v2 as usual.
Insert image description here
You can see that he is still connected successfully here.
Insert image description here

Guess you like

Origin blog.csdn.net/weixin_45966674/article/details/133303862