You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As reported by @hfa0 in #3190comment, 1.2.7 introduces a bug where "error" and "end" listeners directly attached to the Websocket provider aren't firing as expected on close.
Subscriptions and events do have their error handlers fired, and pending requests should also error correctly.
provider=newWeb3.providers.WebsocketProvider(url);provider.on('end',()=>{// not fired});provider.on('error',()=>{// not fired});provider.on('close',(event)=>{// event fired})contract.events[type]({ fromBlock }).on('error',(err)=>{// event fired})provider.disconnect(1012,'restart');
The "close" event contains an object lots of information about what happened fwiw:
Re-opening for visibility. (Not sure how widely used the provider.on('error') pattern is and .on('close') is a reasonable work-around if a patch is a needed asap).
this doesn't work again in 1.3.4 - 'end', 'error' and even 'close' never fire - only 'connect' does. Also, where is the documentation?? Available events description is absent altogether. It needs to be drastically improved. Including the available provider options. Right now there is just a usage example without any explanation of what e.g. "auto" or "keepalive" do and how they are (expected) to work exactly.
As reported by @hfa0 in #3190 comment, 1.2.7 introduces a bug where "error" and "end" listeners directly attached to the Websocket provider aren't firing as expected on close.
Subscriptions and events do have their error handlers fired, and pending requests should also error correctly.
The "close" event contains an object lots of information about what happened fwiw:
Web3.js versions: 1.2.7, 1.2.7-rc.0
The text was updated successfully, but these errors were encountered: