Check Websocket result if data is send in binary format

Hey,

actually I have the following websocket test-script:

`

package websockets

import scala.concurrent.duration._

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import io.gatling.jdbc.Predef._
import io.gatling.jsonpath._

class WebSockets extends Simulation {

val httpProtocol = http
.disableWarmUp
.userAgentHeader(“gatling”)
.wsBaseURL(“ws://localhost:8080”)

val scn = scenario(“WebSocket”)

.exec(ws(“Connect WS”).open("/websocket/dataEcho"))
.repeat(100, “i”) {

exec(ws(“request”).sendText(“1000”)
.check(wsAwait.within(100000 seconds).until(1).regex(""".“data_id” : 1000.0.""")))

}
.exec(ws(“Close WS”).close)

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)

}

`

With this scenario I send a number as a string to the websocket endpoint. In the endpoint I read the number in the OnMessage-Event. Then I use the number to read datasets from the database.
After that I send the datasets back as a string message to gatling and use a check to check if the last dataset is arrived.

Now I want to change the implementation that I send the messages in binary format. On the serverside its not a problem.
In my Gatling script I want the same functionality like in the script above. I think I have to decode the server result in a string before I make the check? How can I do this?
Or is there a better way to check if all datasets are arrived succesfully?

I m looking forward for some help :slight_smile:

UPDATE:

On the serverside I send the data with this method:

`
session.getBasicRemote().sendBinary(ByteBuffer.wrap(data.getBytes()));

`

The method sendBinary() expects a ByteBuffer. So in gatling I want to check the response of this.