云开发云函数调用mqtt.js 连接mqtt服务器报错?
发布于 3 年前 作者 hdai 5734 次浏览 来自 官方Issues

 ReferenceError: wx is not defined mqtt.js中调用wx.connectSocket 找不到wx

2 回复

云开发是nodejs环境,没有wx对象

{“errorCode”:1,“errorMessage”:“user code exception caught”,“stackTrace”:“Error: AMQJS0010E WebSocket is not supported by this browser.\n at new ClientImpl (/var/user/node_modules/paho-mqtt/paho-mqtt.js:772:11)\n at new Client (/var/user/node_modules/paho-mqtt/paho-mqtt.js:1785:17)\n at Runtime.exports.main [as handler] (/var/user/index.js:9:16)\n at Runtime.handleOnce (/var/runtime/node12/Runtime.engine.js:219:23)\n at Timeout._onTimeout (/var/runtime/node12/Runtime.engine.js:56:12)\n at listOnTimeout (internal/timers.js:549:17)\n at processTimers (internal/timers.js:492:7)”,“statusCode”:430}

云函数使用安装paho-mqtt包 不能正常连接mqtt服务器

回到顶部