Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

clearSubscriptions return undefined #3689

Closed
johhonn opened this issue Aug 16, 2020 · 3 comments · Fixed by #3696
Closed

clearSubscriptions return undefined #3689

johhonn opened this issue Aug 16, 2020 · 3 comments · Fixed by #3696
Assignees
Labels
1.x 1.0 related issues Bug Addressing a bug

Comments

@johhonn
Copy link

johhonn commented Aug 16, 2020

Expected behavior

web3.eth.clearSubscriptions returns a boolean

Actual behavior

web3.eth.clearSubscriptions returns undefined

Steps to reproduce the behavior

install web3
instantiate with infura websockets
let web3=new Web3(new Web3.providers.WebsocketProvider(process.env.INFURA));
create a subscription with logs
web3.eth.subscribe('logs', {} ,function(){ ... });

then call web3.eth.clearSubscriptions()

Logs

No error just an undefined result. I also do not seem to be able to start web.eth.subscribe again.

Environment

web3 1.2.11 ,node js version 12.18.3, wsl2 ubuntu 20.04

@GregTheGreek GregTheGreek added 1.x 1.0 related issues Bug Addressing a bug Enhancement Includes improvements or optimizations Feature Request and removed Bug Addressing a bug Enhancement Includes improvements or optimizations labels Aug 16, 2020
@GregTheGreek
Copy link
Contributor

GregTheGreek commented Aug 16, 2020

It is the correct behavior for it to return void (or undefined).

Although I could see it to be beneficial if it did return a boolean.

Thank you for reporting!

@cokia
Copy link
Contributor

cokia commented Aug 17, 2020

"web3.eth.clearsubscriptions()" is shown in the document return type 'Boolean'. It has no mention of return value undefined in the document, and I don't know if this is a problem with your comments or documentation. Under what circumstances is it normal for undefined to appear?

@GregTheGreek
Copy link
Contributor

I misread the documentation, the code is in fact incorrect. The clearSubscriptions has no return value.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
1.x 1.0 related issues Bug Addressing a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants