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

Blocknative websocket warning #60

Open
0xSzeth opened this issue Oct 13, 2021 · 4 comments
Open

Blocknative websocket warning #60

0xSzeth opened this issue Oct 13, 2021 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@0xSzeth
Copy link
Contributor

0xSzeth commented Oct 13, 2021

image

Blocknative logs a warning in the console that the Websocket connection is closed before the connection is established. In this particular example, the warning occurs at line 226 in the web3enabled.ts file, which is where is initialize the instance of bnc-notify and is within the connect() function.

McFly thinks this is causing our app to prevent the loading of data.

Potentially related to the double-load of most pages on init?

@0xSzeth 0xSzeth self-assigned this Oct 13, 2021
@0xSzeth 0xSzeth added the bug Something isn't working label Oct 13, 2021
@0xSzeth
Copy link
Contributor Author

0xSzeth commented Oct 13, 2021

The issue appears to happen intermittently. Will continue to track for now.

@0xSzeth
Copy link
Contributor Author

0xSzeth commented Oct 14, 2021

image

Here's another example where the warning occurs at a different point in the stack. Specifically at line 159 in the web3enabled.ts file, which is where the notify instance is configured. In blocknative's documentation, it says if networkID is passed as a configuration all other wss connections will be closed. Maybe this is causing an issue?

https://docs.blocknative.com/notify#config

@0xSzeth
Copy link
Contributor Author

0xSzeth commented Oct 14, 2021

Every time we fetch an asset price from Chainlink price feeds we're call readonlyweb3() to get a new instance of Web3. Is calling this for every asset price causing the previous connection to break, and therefore the warning? What if we just passed an instance of Web3, calling it a single time from the parent component, vs creating a new Web3 instance every time we fetch a price?

I suppose we could take this even further and just instantiate a new version of Web3 once for the entire application on Init and pass that down to child components as necessary.

@0xSzeth
Copy link
Contributor Author

0xSzeth commented Oct 14, 2021

From the Blocknative discord server:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant