I have a websocket based scenario that is listening to a server that is constantly pushing messages, which I am trying to process. I have a forever loop that is using wsAwait to capture a fixed amount of messages, and then I process the messages in a following exec(). I then loop back to get more messages. However, I think that maybe messages are getting dropped in between calls to wsAwait.
Is this the case? Is there a way I can capture a stream of messages without dropping any?
Here is a the essence of the code I am using:
forever() {
exec(ws(“receiveMessage”).check(wsAwait.within(wsTimeout seconds).until(receiveCount)
.regex("""^[0-9]+|(.*)$""").saveAs(“messages”)))
.exec(session => {
[here I do processing of the messages]
session
})
}
Any help is much appreciated.
Ron