Http requests + ws check on the same script

Hello,

i trie to use http request and web-socket validation in the same scenario for ex:

1- Connect to the websocket

2- Simulate a user action by a http request ex:
.post(“/api/http/ui/v1/products/instances/${session_ID}/wdb/ui/UserAction”)
.headers(headers_JSON)
.body(StringBody(“”“appId=xpert&WndId=0&ItemName=OK_BTN”“”))
.check(status.is(204)))

3- Check the response from the websocket

4- Send another user action and check the response from the web-socket

=> my problème is on the third action (it seems that the connection to WS is lost)

is that possible if yes please send me an example

Thanks a lot

I think your issue is that the websocket already receive the event right after your http request. Then you add a check on it.

Try doing the other way: add a check on your websocket, then perform the http request.

Hope this helps,
Cheers!

Thank you for the quick response, the connection to the websocket is lost after the http request, is there a way to maintain the websocket connection because i have to simulate many user actions (http request) and validate the websocket response after each action

Gatling doesn’t close the connection unless you explicitly call close. If you lose the connection, that’s because the server is closing it.

Thank you @sbrevet and @slandelle it works now.