Gatling 3 Websocket response checks


The data transfer between client and server is in binary format.
So before each gatling request, I’ll need to serialize from objects to binary data. The same goes for server responses where I’ll need to deserialize the binary data to objects.

A sample object would be defined as
class WSRequest
var attr1
var attr2

class WSResponse
var field1
var field2

How can I add a check such that it will deserialize the binary data to WSResponse object and check if field2 contains a particular value?


val myCheck =
ws.checkBinaryMessage(“do myCheck”)
.check(bodyBytes.transform(b =>, new WSResponse))).??? <=== ??? Not sure how I can reference WSResponse

val sendMessage =
exec(ws(“Enqueue matchmaking”).sendBytes(s => {
val wsReq = new WSRequest

}).await(5 seconds)(myCheck))


I’m not a scala expert, so trying to read possible available methods is a bit challenging.