I am currently testing a websocket that will show a lot of messages. the problem I am having is that every thread will catch the first message on the websocket and to be fair I really don’t want to catch the first one either.
The output of the socket is a stream of jsonObjects. Preferably each thread would select a random incoming jsonObject and do my validations on them.
Is there anyway to this?
My current setup is as follows:
.exec(ws("Connect WS")
.connect(wsPath+"${JWTtoken}")
)
.pause(1,5)
.repeat(1,"n") {
exec(ws("subscribe to topic")
.sendText("""{"subscription":{"something":["something","completed"],"operation":null}}""")
.await(10 seconds)(
ws.checkTextMessage("checkTopic").check(
regex(".*\"type\":\"Feature\".*"),
jsonPath("$.properties.id").saveAs("Id")
)
))
.exec(session => {
Id = session("Id").as[String].trim
println("%%%%%%%%%%% ID ===>>>>> " + Id)
session
}
)
}
Thanks in advance.
Kind regards.