Latency for WS messages

Hello,

I want to get latency between WS messages, I found it possible to add several checks with the Name, now I want to create a function that allows adding N checks for the object returned from sendText

Now, I have this

class Websocket extends Simulation {
val httpProtocol: HttpProtocolBuilder = http.baseUrl(“http://demos.kaazing.com”)
.wsBaseUrl(“wss://someWsUrl”)

val scene = scenario(“WS”)
.exec(ws(“OpenSocket”).connect("")
.onConnected(exec(ws(“Topic”)
.sendText(“data”)
.await(30)(ws.checkTextMessage(“result”))
.await(30)(ws.checkTextMessage(“result”))
.await(30)(ws.checkTextMessage(“result”))
.await(30)(ws.checkTextMessage(“result”))
.await(30)(ws.checkTextMessage(“result”))
.await(30)(ws.checkTextMessage(“result”))
)))
.pause(30)
.exec(ws(“closeConnection”).close)

setUp(scene.inject(atOnceUsers(1)).protocols(httpProtocol))
}

I tried to put WsSendTextFrameBuilder object to the session and retrieve it in repeat function, but I get such an error

type mismatch;
found : Unit
required: io.gatling.commons.validation.Validation[io.gatling.core.session.Session]
exec(session=> println(session(“ws-send-awaiter”).as[String]))

class Websocket extends Simulation {
val httpProtocol: HttpProtocolBuilder = http.baseUrl(“http://demos.kaazing.com”)
.wsBaseUrl(“wss://someWsUrl”)

val scene = scenario(“WS”)
.exec(ws(“OpenSocket”)
.connect("")
.onConnected(exec(session => session.set(“ws-send-awaiter”, ws(“Topic”)
.sendText(“data”)
))))
.repeat(10,“i”) {
exec(session=> session(“ws-send-awaiter”).as[io.gatling.http.action.ws.WsSendTextFrameBuilder].await(10)(ws.checkTextMessage(“result”)))
}
.pause(30)
.exec(ws(“closeConnection”).close)

setUp(scene.inject(atOnceUsers(1)).protocols(httpProtocol))
}

Could you help me please

I’ve resolved an issue with “type mismatch”. Now I’m interesting why there are no “result” requests in Gatling report

пятница, 19 марта 2021 г. в 10:39:14 UTC+2, Vladyslav Lutsenko: