# Websockets extensions error

**URL:** <https://community.gatling.io/t/websockets-extensions-error/3218>\
**Category:** Gatling (Open-Source)\
**Created:** [August 26, 2016, 8:02am UTC](https://community.gatling.io/t/websockets-extensions-error/3218 "2016-08-26T08:02:53Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Gutierr](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@Jose\_Antonio\_Gutierr](https://community.gatling.io/u/Jose_Antonio_Gutierr)\
**Post date:** [August 26, 2016, 8:02am UTC](https://community.gatling.io/t/websockets-extensions-error/3218/1 "2016-08-26T08:02:53Z")

</div>

Hi all,

I’m trying to use Websockets with extensions but they are not working.

Could someone shed light on this problem?

The example code is very simple:

`

val headers\_wss = Map(

“Accept-Encoding” → “gzip, deflate, sdch, br”,

“Accept-Language” → “es,en;q=0.8”,

“Pragma” → “no-cache”,

“Cache-Control” → “no-cache”,

“Connection” → “Upgrade”,

**"Sec-WebSocket-Extensions" → “permessage-deflate; client\_max\_window\_bits”, // if this header is included the following exception is raised**

“Sec-WebSocket-Key” → “Soc5rel3sgoH5Ku2ZWcHjQ==”,

“Sec-WebSocket-Version” → “13”,

“Upgrade” -\>“websocket”)

val scnWebsocketsSecure = scenario(“WebSockets Secure scenario”)

.exec(ws(“socket”)

.open(“wss://echo.websocket.org/?encoding=text”)

.headers(headers\_wss)

.check(wsAwait.within(120).until(1).regex("._id._"))

)

.exec(ws(“socket”).close)

setUp(scnWebsocketsSecure.inject(atOnceUsers(1)))

`

- this code is not exacly the same code I’m testing.

Output:

08:37:21.288 [WARN] o.a.n.h.WebSocketHandler - onError {}  
io.netty.handler.codec.CorruptedFrameException: RSV != 0 and no extension negoti  
ated, RSV:4  
at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.protoc  
olViolation(WebSocket08FrameDecoder.java:434)  
at io.netty.handler.codec.http.websocketx.WebSocket08FrameDecoder.decode  
(WebSocket08FrameDecoder.java:156)  
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.j  
ava:367)  
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessage  
Decoder.java:248)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:342)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra  
ctChannelHandlerContext.java:321)  
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1070)  
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:904)  
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageD  
ecoder.java:411)  
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessage  
Decoder.java:248)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:342)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra  
ctChannelHandlerContext.java:321)  
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(Defau  
ltChannelPipeline.java:1280)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:342)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChanne  
lPipeline.java:890)  
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(Abstra  
ctNioByteChannel.java:131)  
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.jav  
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEve  
ntLoop.java:505)  
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.ja  
va:419)  
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:391)  
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThread  
EventExecutor.java:112)  
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorato  
r.run(DefaultThreadFactory.java:145)  
at java.lang.Thread.run(Thread.java:745)  
08:37:21.292 [ERROR] o.a.n.w.NettyWebSocket - WebSocketListener.onError crash  
java.lang.NullPointerException: null  
at io.gatling.http.action.async.ws.WsListener.onError(WsListener.scala:5  
0)  
at org.asynchttpclient.netty.ws.NettyWebSocket.onError(NettyWebSocket.ja  
va:152)  
at org.asynchttpclient.netty.handler.WebSocketHandler.handleException(We  
bSocketHandler.java:213)  
at org.asynchttpclient.netty.handler.AsyncHttpClientHandler.exceptionCau  
ght(AsyncHttpClientHandler.java:212)  
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(  
AbstractChannelHandlerContext.java:273)  
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(  
AbstractChannelHandlerContext.java:252)  
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(Ab  
stractChannelHandlerContext.java:244)  
at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(Channel  
InboundHandlerAdapter.java:131)  
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(  
AbstractChannelHandlerContext.java:273)  
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(  
AbstractChannelHandlerContext.java:252)  
at io.netty.channel.AbstractChannelHandlerContext.fireExceptionCaught(Ab  
stractChannelHandlerContext.java:244)  
at io.netty.channel.ChannelInboundHandlerAdapter.exceptionCaught(Channel  
InboundHandlerAdapter.java:131)  
at io.netty.channel.AbstractChannelHandlerContext.invokeExceptionCaught(  
AbstractChannelHandlerContext.java:273)  
at io.netty.channel.AbstractChannelHandlerContext.notifyHandlerException  
(AbstractChannelHandlerContext.java:831)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:344)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra  
ctChannelHandlerContext.java:321)  
at io.netty.handler.ssl.SslHandler.unwrap(SslHandler.java:1070)  
at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:904)  
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageD  
ecoder.java:411)  
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessage  
Decoder.java:248)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:342)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(Abstra  
ctChannelHandlerContext.java:321)  
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(Defau  
ltChannelPipeline.java:1280)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:342)  
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(Abst  
ractChannelHandlerContext.java:328)  
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChanne  
lPipeline.java:890)  
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(Abstra  
ctNioByteChannel.java:131)  
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.jav  
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEve  
ntLoop.java:505)  
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.ja  
va:419)  
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:391)  
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThread  
EventExecutor.java:112)  
at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorato  
r.run(DefaultThreadFactory.java:145)  
at java.lang.Thread.run(Thread.java:745)

Thx.

---

<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:** [August 26, 2016, 8:10am UTC](https://community.gatling.io/t/websockets-extensions-error/3218/2 "2016-08-26T08:10:59Z")

</div>

WebSocket extensions are not supported atm.  
WebSocket extensions are a way to implement custom features on top of the standard protocol.

If we were to support them, it means we would have to provide you with hooks to implement your extension on the client side (here, I guess it would mean inflating the messages), as extensions are by essence purely proprietary stuff.

You’re the first one to ask for it, so we basically don’t have enough feedback atm.

---

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Gutierr](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@Jose\_Antonio\_Gutierr](https://community.gatling.io/u/Jose_Antonio_Gutierr)\
**Post date:** [August 26, 2016, 8:32am UTC](https://community.gatling.io/t/websockets-extensions-error/3218/3 "2016-08-26T08:32:05Z")

</div>

Thx for your quick response :).

We are looking specifically for Websocket compression.

---

<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:** [August 26, 2016, 8:53am UTC](https://community.gatling.io/t/websockets-extensions-error/3218/4 "2016-08-26T08:53:59Z")

</div>

> Thx for your quick response :).
> 
> We are looking specifically for Websocket compression.

I got that.  
But some other people might have different needs.  
For now we don't have sufficient feedback to make sure we come up with a  
proper API that would match all many use cases as possible.  
And you're the first one to ask for WebSocket Extensions support, so it's  
not a priority for us.

As a consequence, I don't think we'll investigate this ourselves any time  
soon, except through a consulting or sponsorship contract.  
Then, contributions are of course welcome.

\*Stéphane Landelle\*  
\*GatlingCorp CEO\*  
slandelle@gatling.io

---

<div class="post-metadata">

**Author:** ![Jose\_Antonio\_Gutierr](https://avatars.discourse-cdn.com/v4/letter/j/c37758/32.png) [@Jose\_Antonio\_Gutierr](https://community.gatling.io/u/Jose_Antonio_Gutierr)\
**Post date:** [August 26, 2016, 12:08pm UTC](https://community.gatling.io/t/websockets-extensions-error/3218/5 "2016-08-26T12:08:12Z")

</div>

I have seen that netty libraries (netty-codec-http-4.0.37.Final.jar) used by Gatling 2.2.2 are not including websockets extension capabilities but in 4.1 is already included.

---

<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:** [August 26, 2016, 12:12pm UTC](https://community.gatling.io/t/websockets-extensions-error/3218/6 "2016-08-26T12:12:13Z")

</div>

Yes, and we’ll upgrade at some point.  
But still, WebSocket Extension won’t just magically works by upgrading Netty version.  
You’d still need some hook so that you can implement in Gatling the client side of your extension.
