Websocket close check


I’m currently working on using Gatling (3.0.0-RC1) to test against one of our services. The service itself closes the connection and doesn’t rely on the client to do so. I wanted to know if there was a good way to perform a websocket check on the websocket close code or message. Attempts to check text frame result in Gatling reporting an error: “WebSocket crashed while waiting for check: {success message}”. I thought I could use the ws.checkBinaryMessage to check close frame contents, but there doesn’t seem to be any documentation on how to use it, other than “You can use almost all the same check criteria as for HTTP requests”. Digging through the source, I couldn’t really formulate a way to use checkBinaryMessage with a byte array.

My code looks something like this:

exec(ws(“Open socket”).connect("${serviceUrl}").await(120) (
ws.checkTextMessage(“Expect Close”).matching(regex(""“success.message”""))

Any help or advice would be appreciated.