js-adapter icon indicating copy to clipboard operation
js-adapter copied to clipboard

Websocket connection closed over time. "Expected websocket state OPEN but found CLOSED"

Open tratch opened this issue 6 years ago • 1 comments

hadouken-js-adapter version: 1.44.1

Our application opens a connection to an openfin runtime to subscribe to messages on the InterApplication bus and to check if an app with a given uuid exists.

However, if some time passes after calling connect, we get the following error: Expected websocket state OPEN but found CLOSED.

For example:

      const fin = await connect({
        uuid: uuidV4(),
        runtime: {
          version: 'stable'
        }
      });

...
// elsewhere in the code a few seconds later
fin.System.resolveUuid('1234');
// error thrown: Expected websocket state OPEN but found CLOSED

Notes:

  • Seeing the same behaviour in hadouken-js-adapter version 0.42.2
  • For context, nonPersistent is set to false

tratch avatar Aug 28 '19 19:08 tratch

Hey @tratch could you share the code to reproduce this ? currently not being able to see this. This is my code:

const { connect, Identity } = require("hadouken-js-adapter");

async function launchApp() {
    const fin  = await connect({
        uuid: "my-uuid-123",
        runtime: {
            version: 'stable'
        }
    });

    const version = await fin.System.getVersion();
    console.log("Connected to Hadouken version", version);

    // await fin.Application.start({
    //     name: "adapter-test-app",
    //     url: 'http://hadouken.io/',
    //     uuid: "adapter-test-app",
    //     autoShow: true,
    //     nonPersistent : false
    // });

    fin.System.resolveUuid('my-uuid-123').then(console.log).catch(console.log);
}

launchApp().then(() => {
    console.log("success");
}).catch((err) => {
    console.log("Error trying to connect,", err.message);
    console.log(err.stack);
});

rdepena avatar Sep 18 '19 20:09 rdepena