# Websocket test ok with browser but crashes with Gatling

**URL:** https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692
**Category:** Gatling (Open-Source)
**Created:** [December 3, 2015, 3:41pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692 "2015-12-03T15:41:19Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sergi\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sergi\_Gonzalez](https://community.gatling.io/u/Sergi_Gonzalez)
#### Post date: [December 3, 2015, 3:41pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692/1 "2015-12-03T15:41:19Z")

</div>

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](http://i.stack.imgur.com/T64Rq.png)

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](http://www.websocket.org/echo.html) and it works.

My Gatling test:

class BasicTest extends Simulation {

val httpConf = http  
.baseURL(“[http://localhost:9000](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](http://i.stack.imgur.com/qIu8E.png)

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

Regards,  
Sergi

---

<div class="post-metadata">

### Author: ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)
#### Post date: [December 3, 2015, 3:50pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692/2 "2015-12-03T15:50:25Z")

</div>

Same answer as on SOF: [http://stackoverflow.com/questions/34061078/websocket-works-in-browser-but-hangs-from-other-clients](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.

---

<div class="post-metadata">

### Author: ![Sergi\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sergi\_Gonzalez](https://community.gatling.io/u/Sergi_Gonzalez)
#### Post date: [December 3, 2015, 4:05pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692/3 "2015-12-03T16:05:55Z")

</div>

Hi,

The code is not public…

I’m testing now against [https://github.com/JAVEO/clustered-chat#master](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.

---

<div class="post-metadata">

### Author: ![Sergi\_Gonzalez](https://avatars.discourse-cdn.com/v4/letter/s/ec9cab/32.png) [@Sergi\_Gonzalez](https://community.gatling.io/u/Sergi_Gonzalez)
#### Post date: [December 3, 2015, 4:23pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692/4 "2015-12-03T16:23:39Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)
#### Post date: [December 4, 2015, 12:45pm UTC](https://community.gatling.io/t/websocket-test-ok-with-browser-but-crashes-with-gatling/2692/5 "2015-12-04T12:45:34Z")

</div>

lol

Thanks for your feedback
