I want to connect to a web socket through gatling. But it is not working. The socket listener does not get any messsage. The code is given below.Can anyone suggest the problem? Is there any recording option for websocket in gatling. the recorder only record http requests.
`val scn = scenario("RecordedSimulation")
.exec(http("login")
.post("/user/login")
.formParam("email", "username")
.formParam("password", "*******")
.check(headerRegex("Set-Cookie", "localhost:1337.sid=(.*); Path=/").saveAs("cookie")))
.pause(5)
.exec(http("get sid")
.get("/socket.io/?EIO=3&transport=polling&t=1468496890883-0")
.headers(headers_3)
.check(regex("\"sid\":\"(.*)\",").saveAs("sid"))
)
.pause(4)
.exec(ws("Connect WebSocket").open("/socket.io/?EIO=3&transport=websocket&sid=${sid}")
.headers(Map(
"Accept-Encoding" -> "gzip, deflate, sdch",
"Accept-Language" -> "en-US,en;q=0.8",
"Pragma" -> "no-cache",
"Host" -> "localhost:1337",
"Cache-Control" -> "no-cache",
"Connection" -> "Upgrade",
"Origin" -> "http://localhost:1337",
"Sec-WebSocket-Extensions" -> "permessage-deflate; client_max_window_bits",
"Sec-WebSocket-Key" -> "sBWXugNrGCMSXmO3BEm4yw==",
"Sec-WebSocket-Version" -> "13",
"Upgrade" ->"websocket",
"Cookie" -> "io=${sid}; __cfduid=d1cf62d5cf275e2c709080ad7610da8b61465800778; cf_clearance=42068d23995e3243b3ee748ac616389d5cc27d92-1468865525-1800; _gat=1; _ga=GA1.2.1134427855.1467369017; localhost:1337.sid=${cookie}"
)))
.pause(1)
.exec(http("Run")
.post("/posturl")
.headers(headers_13)
.body(RawFileBody("RecordedSimulation_0013_request.txt")))
.exec(ws("Set Check for instance ID")
.check(wsAwait.within(30).until(1).regex("\"intInstanceID\":\"(.*-.*-.*-.*-.*)\",").saveAs("instanceID")))
.pause(1)
.exec(ws("Say Hello WS")
.sendText("""{"text": "Hello, I'm ${sid}"}"""))
.exec( session =>{
println(session("cookie").as[String])
session
})
setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)
}`