I am using the latest version of Gatling 3.x.
Everything works fine while performing a performance test for small duration.
When I am running for longer duration with decent vu, I get below exception for multiple calls.
Is it issue with application under test or my script issue?
\[ERROR\] io.gatling.http.action.ws.WsConnect - Failed to build request ISN-WebSocket: Unable to create a new WebSocket with name gatling.http.webSocket: already exists.
What can I do to handle it?
Below is sample script:
public static ChainBuilder testSignalR() {
// 1. Connect
exec(ws("ISN-WebSocket").connect("wss://<WSS_HOST><API_PATH>/hubs/<SUBSCRIBE_HUB>"))
// 2 & 3. Handshake + Subscribe — exit block on timeout/failure,
// but always reach the close() below
.exec(
exitBlockOnFail()
.on(
// 2. Handshake → await {} ACK
exec(ws("ISN-WebSocket")
.sendText("{\"protocol\":\"json\",\"version\":1}" + RS)
.await(15)
.on(
ws.checkTextMessage("SignalR Handshake ACK")
.check(regex("\\{\\}").exists().name("ISN-WebSocket Handshake ACK"))))
// 3. Subscribe invocation → await type-3 completion
.exec(
ws("ISN-WebSocket")
.sendText("{\"arguments\":[\"#{user_uid}\"],\"invocationId\":\"0\",\"target\":\"SubscribeNewDataAvailableNotification\",\"type\":1}" + RS)
.await(15)
.on(
ws.checkTextMessage("SignalR Subscribe ACK")
.check(regex("\"type\"\\s*:\\s*3").exists().name("ISN-WebSocket Subscribe Completion")))))))
// 4. Close — always executed even if handshake/subscribe failed/timed out
.exec(ws("ISN-WebSocket").close())
.pause(2, 5);
}