Gatling Check on Web socket

Hello @here
First of all, I want to thanks a lot the Gatling team for there amazing tool !!!
It really really helpfull, and give us the oportunity to optimize our Cloud Web app.

I’m here because I have two problem I want to fix :

  1. When I open a websocket, is there a way to check if the ws is correctly open ?
.exec(
  ws("Open_WS")
    .open("/api/v1/stream-websocket")
    .headers(headers.headers_1).headers(headers.authHeader("${token}"))

Something like we have on http ( .check(status.is(200))) )

  1. When the websocket is correctly open, I send a message and wait for the 4th message. If it contains “FLOW_ERROR”, I want to consider that there is an error.
    Currently, I’m doing that :
.group("Computation") {
  exec(
    ws("First_Compute_Action")
      .sendText("${first_action}")
      .check(wsAwait.within(20).until(4).regex(".*${customer_id}.*").saveAs("first_action_status"))
  ).pause(minPause second, maxPause second)
}
.doIf(session => session.contains("first_action_status") && session("first_action_status").as[Seq[String]].exists(_.contains("FLOW_ERROR"))) {
  exec(http("FirstAction_Fail").get("/api/v1/fake")
    .headers(headers.headers_1).headers(headers.authHeader("${token}"))
    .check(status.is(251)))
}

When I get the FLOW_ERROR, I need to perform a Get on an endpoint that I know it will return me 200 and I compare it to 251 to be sure it will fail.

I’m pretty sure there is something smarter than that :slight_smile:

Thanks a lot for your help and feedback.

Best regards,