收藏
回答

watch一直报402002

框架类型 问题类型 终端类型 AppID 环境ID 基础库版本
小程序 Bug 微信iOS客户端 wxa117a9b01fb61527 words-prod-4gwmspzg09e57fe0 2.25.3

Error: errCode: -402002 realtime listener init watch fail | errMsg: login fail Error: invalid state: ws connection not exists, can not send message

history states: UNINIT-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(close)->CLOSED

    at _FSMListener (WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1)

    at WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1

    at Set.forEach (<anonymous>)

    at xo.transition (WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1)

    at Ia.<anonymous> (WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1)

    at Generator.throw (<anonymous>)

    at t (WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1)

    at l (WASubContext.js?t=wechat&s=1683950966850&v=2.25.3:1)

最后一次编辑于  2023-05-15
回答关注问题邀请回答
收藏

3 个回答

  • Mr.劉
    Mr.劉
    2023-05-15

    没有官方人员解决吗?

    2023-05-15
    有用
    回复
  • 宁静致远
    宁静致远
    2023-05-14

    怎么反馈到官方,我这也有这个问题,频繁报错:

    watch closed Error: errCode: -402002 realtime listener init watch fail | errMsg: login fail Error: wsclient.send timedout

    history states: UNINIT-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(loginStart)->INIT_LOGGING_IN-(loginFail)->INIT_LOGIN_FAIL-(close)->CLOSED

        at _FSMListener (WACloud.js:1)

        at WACloud.js:1

        at Set.forEach (<anonymous>)

        at ma.transition (WACloud.js:1)

        at hs.<anonymous> (WACloud.js:1)

        at Iterator.throw (<anonymous>)

        at t (WACloud.js:1)

        at u (WACloud.js:1)

    2023-05-14
    有用
    回复 2
    • 宁静致远
      宁静致远
      2023-05-14
      我是真机运行,根本就不行
      2023-05-14
      回复
    • Mr.劉
      Mr.劉
      2023-05-14
      我也是,安卓和iOS都报错
      2023-05-14
      回复
  • Ray
    Ray
    2023-05-13

    代码

    2023-05-13
    有用
    回复 3
    • Mr.劉
      Mr.劉
      2023-05-13
      async initCombatWatcher (id: DB.DocumentId) {
          // @ts-expect-error
          this.combatWatcher = await combatModel.watch(id, watcherChange.bind(this), (e) => {
            void this.closeCombatWatcher()
            console.log(e)
            toast.show('服务器连接超时,请重试' , 1200).finally(() => {
              this.onBack()
            })
          })
        },
      2023-05-13
      回复
    • Mr.劉
      Mr.劉
      2023-05-13回复Mr.劉
      async watch (_id: DB.DocumentId, onChange: (snapshot: DB.ISnapshot) => void, onError: (error: any) => void): Promise<DB.RealtimeListener> {
          return await new Promise((resolve) => {
            const listener = this.model.doc(_id).watch({
              onChange (snapshot) {
                if (snapshot.type === 'init') {
                  resolve(listener)
                }
                onChange.call(this, snapshot)
              },
              onError
            })
          })
        }
      2023-05-13
      回复
    • Mr.劉
      Mr.劉
      2023-05-13
      前几天一直好好的,今天突然不行了
      2023-05-13
      回复
登录 后发表内容