Saving multiple WebSocket events - using single "sendText"

Hello everyone,

I am trying to receive multiple events from WebSocket channel, using a single sendText command

The reason is that we want to complete the test after X time or receiving all events or Y events (both will do for us)

We are able to receive a single event using code similar to the below, but we need to do so as i mentioned for more than one without sending something new to the server.

ws(“Subscribe to Service”)
.sendText("""{<SUBSCRIPTION JSON TEXT}""".stripMargin)
.checkTextMessage(“WS Service Check”)
.check(jsonPath("$… “).is(”${ }"))
.check(jsonPath("$… “).saveAs(”"))

Is this feasible somehow? Can anyone point to the appropriate direction? (e.g. remove matching and check and save somehow all event that arrive?)

Thank you all for your time and the great tool you are building,


Thank you so much Stephane, i totally missed that

Is it also feasible to store for every frame the current timestamp (in the session or elsewhere)?

i have implemented a dynamic key name, containing the current timestamp in the suffix of the attribute , i am just checking if there is a more elegant solution
e.g i have used
.check(jsonPath("").saveAs(“receivedTime1_” + dateFormatter.format(

Hmmm… however from what i understand this runs not at the same time the check runs but during initialization

Is there any way i can correlate a saved json path with the actual timestamp the server processed the check?

Hello again

with the help of a colleague we found the following solution to use dynamic name, containing the current timestamp, to match the current timestamp with the value of the json
If there is any more “elegant solution” please let us know if possible

check (jsonPath("$.<JSON_PATH>").transformWithSession((string, session) => {
“receivedTime1_” +dateFormatter.format(

thank you for your time