WebSocket. Is there any way to wait for a indefinite amount of messages in a fixed time.

Hi, for my WebSocket simulation I need to send message to a server and then wait a fixed time for indefinite number of frames as a response.

With Gatling 2.3.1 I was using syntax like this:

import io.gatling.core.scenario.Simulation

import io.gatling.core.Predef._
import io.gatling.core.structure.ScenarioBuilder
import io.gatling.http.Predef._

import scala.concurrent.duration._

class Profile extends Simulation {

  val scn: ScenarioBuilder = scenario("Test updates").repeat(1) {
    exec(ws("Open socket").open("ws://localhost:8080"))
      .exec(ws("Get updates").sendText("get_updates").check(wsAwait.within(20.seconds).expect(0).jsonPath("$.code").not("0")))
  }

  setUp(scn.inject(atOnceUsers(1)))
}

In this snippet of code, I am sending a command to a server, and after it script waits specified amount of time, receives a messages and checks it for zero error code (I can see it in log).

In Gatling 3.1 there are no “expect” method for messages.

Is there any way to implement logic described above with WebSocket DSL of Gatling 3.1?

I also faced with the same problem if you found any solution or any workaround please let us know. Thanks .

I’m also looking to monitor messages coming from the websocket and not just wait for one and be done. I can’t figure out how to loop on a check to listen for all messages coming in.