出问题的是pc端小程序,在手机和开发工具上都没问题
出错信息:
the orders watch closed because of error <Error: errCode: -402002 realtime listener init watch fail | errMsg: init watch fail Error: wsclient.send timedout
history states: UNINIT-(loginStart)->INIT_LOGGING_IN-(loginSuccess)->INIT_LOGGED_IN-(initWatchStart)->INIT_WATCH_PENDING-(initWatchFail)->INIT_WATCH_FAIL-(loginStart)->INIT_LOGGING_IN-(loginSuccess)->INIT_LOGGED_IN-(initWatchStart)->INIT_WATCH_PENDING-(initWatchFail)->INIT_WATCH_FAIL-(loginStart)->INIT_LOGGING_IN-(loginSuccess)->INIT_LOGGED_IN-(initWatchStart)->INIT_WATCH_PENDING-(initWatchFail)->INIT_WATCH_FAIL-(close)->CLOSED>
代码很简单,而且在手机端和devtool都正常运行
this.ordersWatcher = db.collection('cats-order').where({
shopId: shop._id
}).watch({
onChange: (snapshot) => {
},
onError: (err) => {
console.error('the orders watch closed because of error', err)
}
})