Iām consistently getting this ā4004 Draining Connectionā error. It happens a few times a day. Iām using the web socket connection and am listening to events like so:
contract.events.Transfer(function(err, event) {
ā¦
});
Here is how Iām connecting:
let provider = new Web3.providers.WebsocketProvider(āwss://speedy-nodes-nyc.moralis.io/ā + MORALIS_ID + ā/polygon/mumbai/wsā, options);
web3 = new Web3(provider);
Is this due to being rate limited? Please let me know what the fix would be.
Here is the stack trace:
web: Error: CONNECTION ERROR: The connection got closed with the close code 4041
and the following reason string Draining connection
web: at Object.ConnectionError (/var/app/current/node_modules/web3-core-helpers/lib/errors.js:66:23)
web: at Object.ConnectionCloseError (/var/app/current/node_modules/web3-core-helpers/lib/errors.js:53:25)
web: at /var/app/current/node_modules/web3-core-requestmanager/lib/index.js:120:50
web: at Map.forEach ()
web: at WebsocketProvider.disconnect (/var/app/current/node_modules/web3-core-requestmanager/lib/index.js:119:37)
web: at WebsocketProvider.emit (/var/app/current/node_modules/eventemitter3/index.js:181:35)
web: at WebsocketProvider._onClose (/var/app/current/node_modules/web3-providers-ws/lib/index.js:152:10)
web: at W3CWebSocket._dispatchEvent [as dispatchEvent] (/var/app/current/node_modules/yaeti/lib/EventTarget.js:115:12)
web: at W3CWebSocket.onClose (/var/app/current/node_modules/websocket/lib/W3CWebSocket.js:228:10)
web: at WebSocketConnection. (/var/app/current/node_modules/websocket/lib/W3CWebSocket.js:201:17)
web: at WebSocketConnection.emit (events.js:400:28)
web: at WebSocketConnection.emit (domain.js:470:12)
web: at WebSocketConnection.handleSocketClose (/var/app/current/node_modules/websocket/lib/WebSocketConnection.js:389:14)
web: at TLSSocket.emit (events.js:412:35)
web: at TLSSocket.emit (domain.js:470:12)
web: at net.js:675:12 {
web: code: 4040,
web: reason: āDraining connectionā
web: }
web: Error: CONNECTION ERROR: The connection got closed with the close code 4040
and the following reason string Draining connection
web: at Object.ConnectionError (/var/app/current/node_modules/web3-core-helpers/lib/errors.js:66:23)
web: at Object.ConnectionCloseError (/var/app/current/node_modules/web3-core-helpers/lib/errors.js:53:25)
web: at /var/app/current/node_modules/web3-core-requestmanager/lib/index.js:120:50
web: at Map.forEach ()
web: at WebsocketProvider.disconnect (/var/app/current/node_modules/web3-core-requestmanager/lib/index.js:119:37)
web: at WebsocketProvider.emit (/var/app/current/node_modules/eventemitter3/index.js:181:35)
web: at WebsocketProvider._onClose (/var/app/current/node_modules/web3-providers-ws/lib/index.js:152:10)
web: at W3CWebSocket._dispatchEvent [as dispatchEvent] (/var/app/current/node_modules/yaeti/lib/EventTarget.js:115:12)
web: at W3CWebSocket.onClose (/var/app/current/node_modules/websocket/lib/W3CWebSocket.js:228:10)
web: at WebSocketConnection. (/var/app/current/node_modules/websocket/lib/W3CWebSocket.js:201:17)
web: at WebSocketConnection.emit (events.js:400:28)
web: at WebSocketConnection.emit (domain.js:470:12)
web: at WebSocketConnection.handleSocketClose (/var/app/current/node_modules/websocket/lib/WebSocketConnection.js:389:14)
web: at TLSSocket.emit (events.js:412:35)
web: at TLSSocket.emit (domain.js:470:12)
web: at net.js:675:12 {
web: code: 4040,
web: reason: āDraining connectionā
web: }