can we set socket id dynamically?

Hey,
i m new in gatling. i want to handle socket id dynamically. Is it possible or not? so please help me.

Can somebody help ?

What do you mean by socket id?

I want to perform load testing on AI Assistant i.e. (Chat bot). AI Assistant was used socket IO to response the message or request.

So I want to generate dynamic Socket Id which is unique for every user for every time.

For Example:-In one of our AI Assistant we have to fill the form first.
Above screenshot is for your reference.
lets assume the scenario that if I have to fill this form via multiple user i.e.100 or more,then in that case once I clicked on "lets get started "as mentioned in above screenshot then socket id get generated .
but In my case if I have to perform load testing for 100 then in that case same socket id get generated for 100 users.

I want either different socket id for 100 users or a dynamic socket id so that we can handle the scenario.

Can somebody help?

Sir Please suggest what to do?

Hi Sharad,

If I guess this is what you want to achieve, creating unique Socket Id for every user during each iteration:

exec {
  session =>
    session.set("sSocketId", s"${Random.alphanumeric take 24 mkString}")
}

Just add this as your starting point before executing actual request, and use “${sSocketId}” where you want to pass the Socket Id.

Regards,
-Raman

Thanks Raman Batra we will let you know is it working or not.

Dear Raman,

Hope you are doing well this morning.
Thanks for your response .Will apply and let you know soon.

Regards
Sharad Sinha

Dear Raman ,

I have applied the code provided by you and its working too but our scenario does not fulfill via code provided by you
Let me explain my scenario:

We have socket server which is hosted at AWS Server and a client socket is a javascript code.
let suppose if some one typed something in html code, then via javascript the request goes to AWS server and automatic socket id has been generated for that.

If multiple user has been connected to AWS Server then for that, multiple socket id generated. Now we want to load test html containing java script web socket code to connect.with AWS socket server. Since we are using socket.io, on disconnect or page refresh the socket id changes. So we wanted to know how we can test this kind of scenario.

Regards
Sharad Sinha

Okay so if I get this right, you guys wanted to correlate the dynamically generated ID.
Maybe this link can help =
https://stackoverflow.com/questions/36792317/correlation-of-dynamic-value-in-gatling

yes .