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

Websocket connection error #245

Closed
ajayrao80 opened this issue Sep 11, 2018 · 2 comments
Closed

Websocket connection error #245

ajayrao80 opened this issue Sep 11, 2018 · 2 comments
Labels
kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked

Comments

@ajayrao80
Copy link

Type: Question

Severity: Low

Description: When a node is disconnected from the internet, when internet comes back, it shows the below error. Obviously because it can't open a webscoket connection with another node. But my question is, can we catch it?

WebSocket connection to 'ws://127.0.0.1:8081/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
module.exports @ F:\classwork\madnet\node_modules\pull-ws\client.js:18
dial @ F:\classwork\madnet\node_modules\libp2p-websockets\src\index.js:26
timeout @ F:\classwork\madnet\node_modules\libp2p-switch\src\limit-dialer\queue.js:79
(anonymous) @ F:\classwork\madnet\node_modules\async\timeout.js:86
(anonymous) @ F:\classwork\madnet\node_modules\async\internal\initialParams.js:11
_dialWithTimeout @ F:\classwork\madnet\node_modules\libp2p-switch\src\limit-dialer\queue.js:86
_doWork @ F:\classwork\madnet\node_modules\libp2p-switch\src\limit-dialer\queue.js:41
DialQueue.queue.queue @ F:\classwork\madnet\node_modules\libp2p-switch\src\limit-dialer\queue.js:25
(anonymous) @ F:\classwork\madnet\node_modules\async\queue.js:10
process @ F:\classwork\madnet\node_modules\async\internal\queue.js:175
(anonymous) @ F:\classwork\madnet\node_modules\async\internal\queue.js:82
(anonymous) @ F:\classwork\madnet\node_modules\async\internal\setImmediate.js:27
runCallback @ timers.js:789
tryOnImmediate @ timers.js:751
processImmediate @ timers.js:722

@jacobheun jacobheun added kind/support A question or request for support status/ready Ready to be worked P3 Low: Not priority right now labels Sep 13, 2018
@jacobheun
Copy link
Contributor

It would be good to wrap the code in libp2p-websockets, https://github.com/libp2p/js-libp2p-websockets/blob/f59cf88cc237a34b0024e25392d7323ff6129c6b/src/index.js#L26-L31, with a try-catch and return the error via the callback.

With the variety of transports libp2p has, we should have them each conform to not throwing errors and instead returning them via callbacks to make the dial handler code in libp2p-switch more uniform.

I've created an issue, libp2p/js-libp2p-websockets#77, to track this. If you're up for submitting a PR that would be much appreciated!

@achingbrain
Copy link
Member

Closing as this is specific to the websocket transport - please see libp2p/js-libp2p-websockets#77 to continue.

maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
* deps(dev): bump aegir from 38.1.8 to 39.0.9

Bumps [aegir](https://github.com/ipfs/aegir) from 38.1.8 to 39.0.9.
- [Release notes](https://github.com/ipfs/aegir/releases)
- [Changelog](https://github.com/ipfs/aegir/blob/master/CHANGELOG.md)
- [Commits](ipfs/aegir@v38.1.8...v39.0.9)

---
updated-dependencies:
- dependency-name: aegir
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* chore: fix linting

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: achingbrain <alex@achingbrain.net>
maschad pushed a commit to maschad/js-libp2p that referenced this issue Jun 21, 2023
## [6.0.3](libp2p/js-libp2p-websockets@v6.0.2...v6.0.3) (2023-06-06)

### Dependencies

* **dev:** bump @libp2p/interface-mocks from 11.0.3 to 12.0.1 ([libp2p#241](libp2p/js-libp2p-websockets#241)) ([f956836](libp2p/js-libp2p-websockets@f956836))
* **dev:** bump aegir from 38.1.8 to 39.0.9 ([libp2p#245](libp2p/js-libp2p-websockets#245)) ([4a35f6b](libp2p/js-libp2p-websockets@4a35f6b))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support A question or request for support P3 Low: Not priority right now status/ready Ready to be worked
Projects
None yet
Development

No branches or pull requests

3 participants