# Gatling 3 Websocket response checks

**URL:** <https://community.gatling.io/t/gatling-3-websocket-response-checks/5528>\
**Category:** Gatling (Open-Source)\
**Created:** [March 5, 2020, 1:21am UTC](https://community.gatling.io/t/gatling-3-websocket-response-checks/5528 "2020-03-05T01:21:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Denny\_Lee](https://avatars.discourse-cdn.com/v4/letter/d/ed655f/32.png) [@Denny\_Lee](https://community.gatling.io/u/Denny_Lee)\
**Post date:** [March 5, 2020, 1:21am UTC](https://community.gatling.io/t/gatling-3-websocket-response-checks/5528/1 "2020-03-05T01:21:14Z")

</div>

Hi,

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 =\> Config._compression_.read(b, **new** WSResponse))).??? \<=== ??? Not sure how I can reference WSResponse

**val** _sendMessage_ =  
exec(_ws_( **“Enqueue matchmaking”** ).sendBytes(s =\> {  
**val wsReq = new WSRequest**

Config._compression_.write(wsReq)  
}).await(5 seconds)(myCheck))

`

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

Denny
