custom ping-pong websocket heartbeating

I’m using gatling to test our product using the websocket api. Things work pretty well with it, and so far we are seeing a lot of good results with Gatling. It’s pretty kickass!

That said, we want to point gatling at an older version of our product that used socket.io v0.9, which used a different heartbeat than ping-pong. It would “ping” with
2::
expecting back an identical2::
as the “pong”.

We’re finding our websocket tests timeout when gatling doesn’t heartbeat back this way. I wanted to add this support in myself (and maybe make a code contribution).

I was looking at how gatling supported ping-pongs in the first place, and I looked through the pr that added the automatic pong reply to ping frames . I’m not quite sure how it’s detecting a “ping” frame (or even how it’s responding “pong”). At this point I’m stumped and must ask: How would I go about modifying wsListener to support this custom heartbeating?

I understand Gatling 3.0 will be shipping with an updated websocket api. Is custom heartbeating (or custom automatic websocket responses) a feature that can be provided in the 3.0 release?
At a minimum, how would I be able to modify gatling to support this specific heartbeating use-case?

Thanks for all of your help!

Sorry,
I should mention I’m using gatling v2.2.2,
and I don’t post to a google group often.

I found a solution! I modified wslistener slightly so that when onMessage is triggered with the 2:: heartbeat it instead replies with a 2:: heartbeat.

`

// WebSocketTextListener
def onMessage(message: String): Unit = {
if (message == “2::”) {
webSocket.sendMessage(“2::”)
}
wsActor ! OnTextMessage(message, nowMillis)
}

`

It only took me all day. I’m leaving this here in case anyone else is curious on how to modify gatling to supply custom heartbeat requests.
Thanks for making a great product!

1 Like