Test scenario that alternately sends REST calls and receives websocket responses

Hi guys,

currently I’m using Gatling 3.0 (due to its new WebSocket API) and I want to create scenario that alternately sends REST calls and receives websocket responses. Scenario would look like this:

  1. Set multiple checks on websocket
  2. Send HTTP request
  3. Receive websocket response
    Unfortunately since version 3.0 websocket async checks are not supported, so every websocket check blocks scenario flow for given amount of time e.g.

val scn = scenario("HTTP WS Mix") .exec(ws2("Ws").connect("/addrs") ) .exec(ws2("TableGamesWs").sendText("") .wait(30 seconds)( ws2.checkTextMessage("") .matching(regex(""".*foo.*""")) .check(regex(""".*(foo).*""").is("bar").check(regex(""".(bar).""").is(“foo”)) ) ) .exec(http("Http Request") .get(service_address) .queryParam("foo", "bar") .check(jsonPath("$.foo").saveAs("bar"))) )

In this example test is waiting 30 seconds and then it sends HTTP request, which obviously is not what need. On the other hand setting checks after HTTP request is not fast enough to catch the WebSocket response.

Any help appreciated,

Piotr