[kovan] Transactions with multiple events dont fire listener

I am listenning multiple events of a contract and when i have one transaction that emits multiple events, the listenner dont seems to be fired.

Because of this i am loosing the events every time.

Tried everything and got nowhere so far.
Transactions with single events is fired normally.

Anyone can help me please???

Hey @Zorke can you please show me an example of a contract / tx having the issue ? Also, some code snippet showing how you listten for those events would help. Thanks !

Hello @traian.vila,

for people having the same issue, i found the mistakes i was doing:

Error number 1: I was using a wrong wss link.
I was using wss://kovan.infura.io/v3/[projectId] instead of wss://kovan.infura.io/ws/v3/[projectId]

Its strange it worked for some events, but it was wrong nonetheless.
Error number 2: when getting the provider to use in the listener i was conecting to the websocket but when instantiating the contract, i was using a http provider. Something like this:

const _web3Socket: WebsocketProvider = new Web3.providers.WebsocketProvider(
// @ts-ignore
clientConfig: {
keepalive: true,
keepaliveInterval: 60000,
let web3ProviderFromSocket = new Web3(_web3Socket);
_web3Socket.on(“connect”, function () {
console.log(“WSS Connected”);
_web3Socket.on(“close”, function () {
console.log(“WS closed”);
console.log(“Attempting to reconnect…”);
_web3Socket= [new web3Socket connection];
_web3Socket.on(“connect”, function () {
console.log(“WSS Reconnected”);
_web3Socket.on(“error”, function () {
console.error(WS Error!);

but then, when instantiating the contract, i was using a http provider, like this:

const _web3Provider = new Web3(“https://kovan.infura.io/v3/[projectId]”);
var web3Contract = new _web3Provider.eth.Contract(
Contract.abi as AbiItem[],
let contractSubObject = web3Contract.events.allEvents({
fromBlock: [currentBlockNumber],
.on(“connected”, function (subId) {
Contract Subscription active with subscription id ${subId}
.on(“data”, async function (event) {
let eventName = event.event.toLowerCase();
if (eventName == []the event i want]){
//do my code

It caused this strange behavior where some events were firing and others dont.

the correct way was to use the web3ProviderFromSocket to instantiate the contract.

after i corrected both things, things are working smoothly.

Hope i can help other people!