I am trying a scenario where a particular user deals with multiple channels [say x,y,z] using the same web socket connection.
For each channel we will be building response back message through web socket.
For eg.
we have one web socket connection for a user
Suppose user is available for X ,Y , Z channel
For every X, Y, Z channel we get desired messages on our web socket
Now these all messages should be read one after the other such that no messages will be dropped and should be buffered that can later be used to build the response back message on web socket
Code snippet below
Suppose in our scenario we are looping in entire Test Duration as
.during(TestDuration minutes)(
exec(*handleRequests*).exitHereIfFailed)
)
For every handleRequest i am saving that to DATA like
val handleRequests: ChainBuilder = {
group(WSRequestGroup)(exec(ws("HandleRequests")
.check(wsAwait.within(MaxWaitDuration).until(1)
.regex(".*").findAll
.saveAs("DATA")))
.exec(getNewmessage)
.exec(sendMessageOnWs)
)
}
The above regex .* is used so that we capture all the data coming to web socket.We are treating that data in getMessage method and sending the constructed message to sendMessageOnWs
Problem
I have noticed that
Multiple event are simultaneously coming on web socket and i can see all the messages on gatling actor as
io.gatling.http.action.async.ws.WsActor - Received text message on websocket
But surprisingly I am not getting the same saveAs ‘DATA’ match on regex, Not sure if the messages are dropping.
I tried using wsListen more messages were dropping thus don’t know a valid approach to buffer all messages and I use it one after the other.
Note the buffering of message and reading of message should be independent.