How can I implement a counter over events received on WebSocket

I am trying something like this below:

exec(
    ws(url).wsName(url-"name").open(endpointUrl)
        .check(wsAwait.within(totalSecondsToWaitFor seconds).expect(Range(totalEventsToWaitFor1, totalEventsToWaitFor2)))

)

And it times out after the given number of seconds. I didnt see check passing, though the events reached in the range. Nonetheless, after time out, I wanted to check how many events indeed it got. 

Does anyone have a clue?

Thanks!

Hi Gautam,

You could define your range with to (right exclusive) or until (right inclusive).

totalEventsToWaitFor1 to totalEventsToWaitFor2

And it times out after the given number of seconds.

Could be a bug. Could you provide a reproducer, please?

Nonetheless, after time out, I wanted to check how many events indeed it got.

You’re supposed to get the number of received messages in the error message.
If you’re still looking for a hack to measure received messages per sec, sadly, that’s not feasible. It would have to be implemented directly in Gatling.