# Does Gatling support testing WebSocket?

**URL:** <https://community.gatling.io/t/does-gatling-support-testing-websocket/156>\
**Category:** Gatling (Open-Source)\
**Created:** [October 31, 2012, 2:06am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156 "2012-10-31T02:06:29Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ngoc](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@Ngoc](https://community.gatling.io/u/Ngoc)\
**Post date:** [October 31, 2012, 2:06am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/1 "2012-10-31T02:06:29Z")

</div>

It seems that Gatling does not support WebSocket at this moment.  
Is there a roadmap for this feature?

I guess this feature is a big advantage for Gatling because many other  
test tools still do not have it.

Thanks.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [October 31, 2012, 7:08am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/2 "2012-10-31T07:08:11Z")

</div>

Hi Ngoc,

We’ll probably add websockets support someday, but I can’t tell you when.  
My feeling is that we’ll have our hands full with more pressing features (injection profiling, clustering, Scala 2.10 migration, SQL support…) until Q2 2013.  
But then… we love contribs 😉

Cheers,

Stéphane

2012/10/31 Ngoc \<[ngocdaothanh@gmail.com](mailto:ngocdaothanh@gmail.com)\>

---

<div class="post-metadata">

**Author:** ![Andrew\_Duffy](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Andrew\_Duffy](https://community.gatling.io/u/Andrew_Duffy)\
**Post date:** [November 6, 2012, 11:15am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/3 "2012-11-06T11:15:54Z")

</div>

I wrote this for testing one of our WebSocket apps in Gilt:

[https://github.com/gilt/gatling-websocket](https://github.com/gilt/gatling-websocket)

… if it’s useful, or if you can suggest changes that would make it useful, I’d love to hear back.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 6, 2012, 2:49pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/4 "2012-11-06T14:49:08Z")

</div>

Hi Andrew,

Very very cool!  
I probably won’t have time to review it in the next 2 weeks (have to prepare my talk for Devoxx, and then… go to Devoxx) but I’ll definitely contact you to see if you could contribute this to Gatling main project.

Just one rapid question: why go for Jetty instead of Netty?

Bravo!

Stéphane

---

<div class="post-metadata">

**Author:** ![Andrew\_Duffy](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Andrew\_Duffy](https://community.gatling.io/u/Andrew_Duffy)\
**Post date:** [November 6, 2012, 2:56pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/5 "2012-11-06T14:56:32Z")

</div>

I did a previous JMeter plugin that used Jetty’s WebSocket lib - that’s the only reason.

I’ll take a look at Netty’s and Grizzly’s equivalents to reduce the number of dependencies later in the week.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 6, 2012, 3:25pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/6 "2012-11-06T15:25:07Z")

</div>

Also note that AHC supports websockets:  
[http://jfarcand.wordpress.com/2011/12/21/writing-websocket-clients-using-asynchttpclient](http://jfarcand.wordpress.com/2011/12/21/writing-websocket-clients-using-asynchttpclient)

---

<div class="post-metadata">

**Author:** ![Andrew\_Duffy](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Andrew\_Duffy](https://community.gatling.io/u/Andrew_Duffy)\
**Post date:** [November 20, 2012, 1:02pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/7 "2012-11-20T13:02:07Z")

</div>

I moved this to AsyncHttpClient; I will need to write something like  
the http protocol config to supply the few configurable parameters,  
but it's certainly usable without it.

-- Andrew

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [November 20, 2012, 3:20pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/8 "2012-11-20T15:20:48Z")

</div>

Hi Andrew,

Very impressive!  
I did some comments on your last commit.

Cheers,

Stéphane

---

<div class="post-metadata">

**Author:** ![Ngoc](https://avatars.discourse-cdn.com/v4/letter/n/e495f1/32.png) [@Ngoc](https://community.gatling.io/u/Ngoc)\
**Post date:** [December 11, 2012, 10:32am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/9 "2012-12-11T10:32:41Z")

</div>

I’ve just created this issue:  
[https://github.com/gilt/gatling-websocket/issues/2](https://github.com/gilt/gatling-websocket/issues/2)

Please help.  
Thanks.

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [December 21, 2012, 6:31pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/10 "2012-12-21T18:31:36Z")

</div>

I wanted to try out that feature and started by seeing what I can do.

I took this to app : [https://github.com/playframework/Play20/tree/master/samples/scala/websocket-chat](https://github.com/playframework/Play20/tree/master/samples/scala/websocket-chat)  
and created the following scenario : [https://gist.github.com/4354730](https://gist.github.com/4354730)

Andrew, is this a correct use of the API ?  
And currently, we can only send messages, is that right ?

My simulation seems working and it’s already pretty cool.

cheers  
Nicolas

---

<div class="post-metadata">

**Author:** ![Andrew\_Duffy](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Andrew\_Duffy](https://community.gatling.io/u/Andrew_Duffy)\
**Post date:** [December 21, 2012, 6:53pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/11 "2012-12-21T18:53:16Z")

</div>

That’s about it. The only thing I’d change is to add the optional parameter so the calls to open have a different request name to the calls to sendMessage and close, which are both very fast. In fact, I think I should probably make it the only behaviour that the requests have the names “\<socket\_name\> Open”, “\<socket\_name\> Send” and “\<socket\_name\> Close”, and maybe add an optional flag to disable recording sends and closes in the log. What do you think? It feels similar to how redirects are reported on now.

Yes, currently you can only send. This is about adding checks on received messages: [https://github.com/gilt/gatling-websocket/issues/1](https://github.com/gilt/gatling-websocket/issues/1) - should I move it over to excilys/gatling? I will work on it (and a few more more ideas, hopefully) over the holiday.

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [December 21, 2012, 7:18pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/12 "2012-12-21T19:18:28Z")

</div>

I’m now watching the gilt/gatling-websocket … I’ll now follow that discussion.

I actually have two remarks about the DSL :

1/ if we do a basic HTTP query, we do .exec(http(LOG\_NAME).get("/"))  
But, for the web socket, we currently have to write this .exec(websocket(WEBSOCKET\_NAME).open(ws://localhost, LOG\_NAME) )  
It has been quite confusing for me not to write .exec(websocket(LOG\_NAME).open(ws://localhost, WEBSOCKET\_NAME) )

Do you see my point ?

2/ I’m not a fan of that open / close thing. I would prefer to come-up with something that has more of the spirit of the “scala-arm” project …  
.withWebsocket(“superWebsocket”, “ws://localhost”) { // it will automatically log the “Open superWebsocket” / “Close superWebsocket”  
ws1 =\>  
exec(http(“foo”).get("/"))  
.exec(websocket(“say hello”).send(“hello”)(ws1))  
}

Would this make sense?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [December 22, 2012, 9:13am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/13 "2012-12-22T09:13:19Z")

</div>

1. You can’t do that, as it would tie the structure API to the websocket module. We want to keep the structure API protocol agnostic in order to implement more protocols (SQL, LDAP, JMS…)

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [December 22, 2012, 9:56am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/14 "2012-12-22T09:56:49Z")

</div>

True.

So, what about that ?

.with(websocketRessource(“ws://localhost”)) {  
…  
}

.with(jdbcRessource(“jdbc://…”)) {  
…  
}

It would mean that we need to introduce a “.with()” element in the core and sort of a “AutoClosable” API.

What do you think ?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [December 22, 2012, 10:05am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/15 "2012-12-22T10:05:43Z")

</div>

This idea is interesting, but I wonder if there's not some redundancy with  
ProtocolConfiguration here.

---

<div class="post-metadata">

**Author:** ![Nicolas\_R](https://avatars.discourse-cdn.com/v4/letter/n/f14d63/32.png) [@Nicolas\_R](https://community.gatling.io/u/Nicolas_R)\
**Post date:** [December 22, 2012, 12:52pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/16 "2012-12-22T12:52:43Z")

</div>

I don’t see what you mean, what kind of redundancy?

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [December 22, 2012, 1:01pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/17 "2012-12-22T13:01:29Z")

</div>

Forget about it, that’s off topic here. That’s just that regarding your jdbcResource, you wouldn’t pass the url, as you would configure a DataSource in a JdbcProtocolConfig.

---

<div class="post-metadata">

**Author:** ![Sebastian\_Hoberg](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@Sebastian\_Hoberg](https://community.gatling.io/u/Sebastian_Hoberg)\
**Post date:** [September 19, 2013, 9:11am UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/18 "2013-09-19T09:11:08Z")

</div>

I tried using the Gatling Websockets Addon with Gatling 2. Does the package support Gatling 2 or just Gatling 1?

Thanks.

Sebastian

---

<div class="post-metadata">

**Author:** ![Andrew\_Duffy](https://avatars.discourse-cdn.com/v4/letter/a/54ee81/32.png) [@Andrew\_Duffy](https://community.gatling.io/u/Andrew_Duffy)\
**Post date:** [September 20, 2013, 12:50pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/19 "2013-09-20T12:50:42Z")

</div>

The WebSocket plugin is for Gatling 1. Most of the functionality has been merged into Gatling, but there isn’t a released milestone containing it yet, unfortunately.

---

<div class="post-metadata">

**Author:** ![Excilys](https://avatars.discourse-cdn.com/v4/letter/e/8797f3/32.png) [@Excilys](https://community.gatling.io/u/Excilys)\
**Post date:** [September 20, 2013, 1:11pm UTC](https://community.gatling.io/t/does-gatling-support-testing-websocket/156/20 "2013-09-20T13:11:18Z")

</div>

Coming, coming… doing our best…

[Next page](https://community.gatling.io/t/does-gatling-support-testing-websocket/156.md?page=2)
