Actual WebSocket connections were shown more than expected.

Hi, I am new to Gatling and using Gatling 3.1.1 and trying to make concurrent WebSocket connections. In my script, I am injecting 30 users and trying to create 30 parallel WebSocket connections. But in the report, it says 30 connections passed and 7 failed. I just didn’t understand why the total connection count is more than the expected?

Below is my script

`
// Scenario Check Login (Actual Script Starts here)

val EmployeeCredentialsFeeder = csv(“data/Test Employees.csv”).batch(30) // Employees Credential feeder(csv)

val scn = scenario(“TXP_Login”)

.feed(EmployeeCredentialsFeeder) // feed clientID, username and password for Login from csv file
.exec(checkLogin()) //Execute checkLogin method
.pause(1)

//create feeder for SessionID and Employee ID. poll() method will retrieve the head item from the queue and delete it
// Here Session ID’s and Employee ID’s are polled from queue and map to Session_ID and Employee_ID variable

val SessionIDFeeder = Iterator.continually(Map(“Session_ID” → Session_ID_Queue.poll()))
val EmployeeIDFeeder = Iterator.continually(Map(“Employee_ID” → Employee_ID_Queue.poll()))

// Get and Update self Scehdule

val scn1 = scenario(“Get_Assign_SelfSCH_Websocket”)

//Make the variables as session variables to have them avaiable in next scenario
.exec(.set(“startDate”,startDate))
.exec(
.set(“endDate”, endDate))
.exec(.set(“Company_ID”, Company_ID))
.exec(
.set(“Branch_ID”, Branch_ID))

//Feed the SessionID, EmployeeID, and clientID through the feeder

.feed(SessionIDFeeder)
.feed(EmployeeIDFeeder)
.feed(EmployeeCredentialsFeeder)

// Make Websocket Connection

.exec(ws(“ConnectSocket”)
.connect("/?clientId=${ClientID}&cid=${Company_ID}&bid=${Branch_ID}&sessionId=${Session_ID}&eid=2")
.onConnected(
exec(ws(“Connection Check”)

.sendText(“Ping”))
.pause(3)))

//.pause(2)
.exec(getSelfSchedule()) // run getSelfSchedule method

.pause(2)
.exec(updateSelfSchedule()) // run updateSelfSchedule method

setUp(scn.inject(rampUsers(30) during(15)), scn1.inject(nothingFor(18 seconds), atOnceUsers(30)).protocols(httpProtocol))
}
`

But in the report, total WebSocket connections count was 37. OK = 30 and KO = 7. Is Gatling trying to reconnect automatically? In my application WebSocket connection disconnects after 30 seconds and to keep the connection alive my team developer is sending a ping message after every 30 seconds. This could be the reason? If yes how to overcome this issue because I am unable to make 50 concurrent connections. Only a few of them are successful and rest are failing. Please help

`