Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot subscribe async on 'backend' event #4

Open
vedadeepta opened this issue Sep 7, 2018 · 0 comments
Open

Cannot subscribe async on 'backend' event #4

vedadeepta opened this issue Sep 7, 2018 · 0 comments

Comments

@vedadeepta
Copy link

vedadeepta commented Sep 7, 2018

branch: react-router-v4-fix

Issue.
It throws error :
uncaught: { ReplyError: ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context

Code :

  shareDbServer(
    {
      getHead: getHead,
      appRoutes: {
        main: getMainRoutes()
      },
      beforeStart: beforeStart
    },
    (ee, options) => {
      ee.on('backend', async (backend) => {
        let model = backend.createModel()
        let $files = model.query('files', {})
        console.log(model.subscribeAsync)
        await model.subscribeAsync($files)
        model.destroy()
      })
    }
  )

It throws an error in line await model.subscribeAsync($files)

Quick Fix:
put the code in setTimeout.

@vedadeepta vedadeepta changed the title uncaught error - uncaught: { ReplyError: ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context uncaught error Sep 7, 2018
@vedadeepta vedadeepta changed the title uncaught error uncaught: { ReplyError: ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context Sep 7, 2018
@vedadeepta vedadeepta changed the title uncaught: { ReplyError: ERR only (P)SUBSCRIBE / (P)UNSUBSCRIBE / PING / QUIT allowed in this context Cannot subscribe async on 'backend' event Sep 7, 2018
vedadeepta added a commit that referenced this issue Jan 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant