Websocket test ok with browser but crashes with Gatling

Hi guys,

I’m currently developing a Play Framework application with websockets and I want to do some load test with Gatling.

When I test my application opening a webserver from Chrome Dev tools everything looks ok:

enter image description here

But when I try to do the same with Gatling I get “Invalid status code 0”. I think there is no problem without Gatling … I think the problem is with Play but I’m not sure… I have tested my Gatling test with http://www.websocket.org/echo.html and it works.

My Gatling test:

class BasicTest extends Simulation {

val httpConf = http
.baseURL(“http://localhost:9000”)
.wsMaxReconnects(1)
.header(“Sec-WebSocket-Version”, “13”)
.header(“Sec-WebSocket-Extensions” , “permessage-deflate client_max_window_bits”)
.acceptLanguageHeader(“en-US,en;q=0.5”)
.acceptEncodingHeader(“gzip, deflate”)
.userAgentHeader(“Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/47.0.2526.73 Safari/537.36”)
.wsBaseURL(“ws://localhost:9000”)

val scn = scenario(“WebSocket”)
.exec(ws(“Connect WS”).open("/socket"))
.pause(10)
.exec(ws(“Close WS”).close)

setUp(scn.inject(rampUsers(1) over 1.seconds)).protocols(httpConf)
}

I get a similar error using wscat

enter image description here

I’m new in websockets stuff… so, any idea about what’s going on will be appreciated.

Regards,
Sergi

Same answer as on SOF: http://stackoverflow.com/questions/34061078/websocket-works-in-browser-but-hangs-from-other-clients

Sample plz

But what’s sure is that Gatling doesn’t support WebSocket Extensions atm.

Hi,

The code is not public…

I’m testing now against https://github.com/JAVEO/clustered-chat#master which is pretty the same than my application and I get same results… “Invalid Status Code 0”

I don’t know if is something about my machine (mac os) but i have created another ws server with wscat (wscat -l 8080 -p 13) and pointing to this, my Gatling test works.

Ok,

Now it works. Play by default works in port 9000 and I had this port binded with php-fpm… But I still don’t understand why Play not crashes when trying to bind the application to an already binded port.

Thanks guys.

lol

Thanks for your feedback