How can use dynamic data in websocket subprotocol?

Hi all.

I need create websocket connection with dynamic subprotocol
Example
.exec(http(“get data”)
.post("/v1/data")
.headers(
Map(“Content-Type” → “application/json”))
.body(StringBody(
“”"{
“mobile”:"${mobile}"}""")
)
.check(
status.is(200),
jsonPath("$.data")
.saveAs(“ses_data”)
)

Then i need to use “ses_data” to subprotocol

.exec(ws(“ws connect).connect(”/ws").subprotocol(“here”))
I am trying

  1. subprotocol("${ses_data}")
  2. global var inside class Simulation
    var data: string = “”

then
.exec( session => data = session.attributes(“ses-data”).toString

then
.exec(ws(“ws connect).connect(”/ws").subprotocol(data))

It is not working. Could you please help me?

It’s not currently possible (as of 3.3.1).
I’ve filled a feature request for 3.4.0: https://github.com/gatling/gatling/issues/3909