Websockets - Close Code & Close Reason - (Question) v. 2.2.2

Hello Gatling folks,

I’ve been performing stress tests for a couple of days and wanted to ask you a question related to close codes and close reasons in web sockets.

I can’t find a way of sending a close code and close reason from the current implementation (Gatling 2.2.2).

The documentation doesn’t mention this and i haven’t been able to find a suitable function (I’m new to Scala and Gatling)

I’m connecting to a jetty websocket implementation of the jsr-356 java spec and looks like no error code or close reason is being sent by the Gatling clients.

Thanks a lot and keep up the good work!


Atm, the only failures that are notified are:

  • exceptions, eg connection crash

  • check failures
    Here, you could get notified with the close reason if:

  • close happens when you tried to connect => failure is related to the connect event

  • there was a flying check when the socket was closed => failure is related to the check

  • you’re trying to send a message and the socket was closed => failure is related to the sent message
    At least that’s how things are supposed to work in our WebSocket support’s next generation: https://github.com/gatling/gatling/issues/3071

Hi Stéphane,

My question was directed to the close status code and close reason sent by the Gatling client to the server.

(Please see: 7.4. Status Codes, 7.4.1. Defined Status Codes, 7.1.6**. The WebSocket Connection Close Reason)

At the moment, I don’t see these being sent by the Gatling client when closing the connection, they are marked as optional in the rfc6455 spec and a closing frame should be enough. On the other hand, the client could be able to include these as parameters or have the 1000 status code set by default when closing the connection.

Thanks for the quick response.


Ah, OK.
Already fixed: https://github.com/AsyncHttpClient/async-http-client/issues/1199