2 Problems with binary websockets


I am having some problems building scenarios for binary websocket transmission. The first is that I cannot receive data back from the server after sending a binary message (which works correctly). Is there some sort of “raw” check I can do to receive and decode what the server is sending back?


exec(ws("Fetch random obj WS")


This check does not work, and regex/json won’t work on a binary msgpack stream coming from the server.

The second problem I am having is putting a session value into a websocket send_bytes. It appears that the exec() will have to return either the ws().sendBytes() or the session, but cannot return both. Is there some way around this, to feed the session value into the sendBytes function?


.exec (
        { session =>
        ws("Submit random WS")
              "stream" -> "objects",
              "payload" -> Map(
                "method" -> "POST",
                "data" -> Map(
                  "random_choice" -> session("random_number").as[Int]


Returning the session makes gatling not send the bytes. Not returning the session and returning the ws().sendBytes() returns the following error:


[ERROR] i.g.c.ZincCompiler$ - … type mismatch;
found : io.gatling.http.action.async.ws.WsSendBuilder
required: io.gatling.commons.validation.Validation[io.gatling.core.session.Session]



I am having the exact same issue in that I can’t grab a binary WebSocket response using the Gatling DSL. If you turn your logback.xml log level from “Warn” to “Debug”, you will get this nice message when you attempt to check a WebSocket call which returns a binary message: “Beware, byte message checks are currently not supported” (WsActor.scala line 177 in the Gatling source).

Only 2 options: 1) hope the Gatling devs implement such support, or 2) implement support and create pull request.


  • Connor