How to test a websocket service that expects a text as input but returns a binary message as output?

Hi,

I would like to test a websocket service that expects a text as input but returns a binary message. I’m new to Gatling and I don’t know Scala.

So I tried to write the scenario as follow (I’m using Gatling 3.0.0):

val scn = scenario("Kbs2LoginSimulation")

  .exec(ws("Connect WS").connect("/frontend/eventbus/websocket")
      .onConnected(
        exec(ws("Login WS")
          .sendText("""A text message""")
          .await(5 seconds)(
            ws.checkBinaryMessage("Check WS").check(...)
          )
        )
        .pause(1)
        .exec(ws("Close WS").close)
      )
  )

But it refuses to compile as it seems ws.checkBinaryMessage can only be used if sendBytes was used to send the input message. And if I use checkTextMessage it compiles but the check doesn’t work and I’m getting this in the logs:

` 17:04:29.720 [GatlingSystem-akka.actor.default-dispatcher-9] DEBUG io.gatling.http.action.ws.fsm.WsActor - Received non-matching text frame [123, 34, 97, 100, ...] `

Actually the binary message returned by the service is a text but it is expressed as message array (of characters) in the websocket response frame.

How can I retrieve that binary message and convert it to text so I can do my check?

Thanks for your help

Current implementation doesn’t support mixing WebSocket text and binary frames.