Websocket Upgrade - Cookie handlingh

Hi,

I am new to Gatling. Still learning so please bear with me if it is basic question

My script code:

.exec(http(“topNav”)
.get(uri04 +"?Id=1000")
.check(status.is(200)))

.exec(ws(“Connect”).open(“ws:///query?t=1”))

.exec(ws(“Subscribe”)

.sendText(“I am active”)
.check(wsListen.within(300).until(5).regex(“active”)))

My Debug log:

15:29:38.306 [INFO ] i.g.h.a.w.WsOpenAction - Opening websocket ‘gatling.http.webSocket’: Scenario ‘scn5’, UserId #6312889040733162120-0
15:29:38.368 [DEBUG] c.n.h.c.p.n.r.NettyConnectListener - Request using non cached Channel ‘[id: 0xe12104e1, /<host:58145 => <uri04AppDomain.com/uri04AppIP]’:
DefaultHttpRequest(chunked: false)
GET query?t=1 HTTP/1.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,/;q=0.8
DNT: 1
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML like Gecko) Version/8.0 Mobile/12A366 Safari/600.1.4
Referer: uri04 +"?Id=1000"
Upgrade: WebSocket
Connection: Upgrade
Origin: websocketAppDomain.com
Sec-WebSocket-Key: EEAA2mif9ocwBG6bmwRVoQ==
Sec-WebSocket-Version: 13
Host: AppIP

15:29:38.426 [DEBUG] i.g.h.a.w.WsActor - Websocket ‘gatling.http.webSocket’ open
15:29:38.427 [DEBUG] o.j.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame opCode=1
15:29:38.427 [DEBUG] o.j.n.h.c.h.w.WebSocket08FrameDecoder - Decoding WebSocket Frame length=39
15:29:38.432 [DEBUG] i.g.h.a.w.WsActor - Received text message on websocket ‘gatling.http.webSocket’:4100C8C4048CE28DF2BF-000DB70800000014
15:29:38.438 [DEBUG] i.g.h.a.w.WsActor - Sending message check on WebSocket ‘gatling.http.webSocket’: TextMessage(I am active)
15:29:38.439 [DEBUG] i.g.h.a.w.WsActor - setCheck blocking=false timeout=300 seconds
15:29:38.441 [DEBUG] o.j.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=1 length=23
15:29:38.455 [DEBUG] i.g.h.a.w.WsActor - Closing websocket ‘gatling.http.webSocket’
15:29:38.458 [DEBUG] o.j.n.h.c.h.w.WebSocket08FrameEncoder - Encoding WebSocket Frame opCode=8 length=0
15:29:38.460 [DEBUG] c.n.h.c.p.n.h.Processor - Channel Closed: [id: 0xe12104e1, /host:58146 :> <websocketAppDomain.com/AppIP] with attribute NettyResponseFuture{currentRetry=0,
isDone=true,
isCancelled=false,
asyncHandler=com.ning.http.client.ws.WebSocketUpgradeHandler@e26eb0,
nettyRequest=com.ning.http.client.providers.netty.request.NettyRequest@135088b,
content=NettyWebSocket{channel=[id: 0xe12104e1, /host:58146 :> websocketAppDomain.com/AppIP]},
uri=ws:///query?t=1,
keepAlive=true,
httpHeaders=org.jboss.netty.handler.codec.http.DefaultHttpHeaders@f5eb06,
exEx=null,
redirectCount=0,
timeoutsHolder=null,
inAuth=false,
statusReceived=false,
touch=22871430}
15:29:38.461 [DEBUG] c.n.h.c.p.n.c.ChannelManager - Closing Channel [id: 0xe12104e1, /host:58146 :> websocketAppDomain.com/AppIP]
15:29:38.469 [DEBUG] c.n.h.c.p.n.h.Processor - Channel Closed: [id: 0x9709b2bb, /host:58145 :>uri04AppDomain.com/uri04AppIP] with attribute INSTANCE
15:29:38.469 [INFO ] i.g.c.c.Controller - End user #6312889040733162120-0

On Chrome Dev tools, I do see

  1. HTTP/1.1 101 Switching Protocols Upgrade: WebSocket Connection: Upgrade Sec-WebSocket-Accept: SomeKey Set-Cookie: session=SomeCookie; HttpOnly
    I believe I am missing the session cookie above during the wslisten.

Is there a way to capture the session cookie and force it during the wslisten?

Or is it something completely wrong in my code?

P.S: Issue persists even if I change to wsAwait. Message: Websocket ‘gatling.http.webSocket’ was unexpectedly closed with status 1006 and message Connection was closed abnormally (th…

Thanks
Raj

Looks like a bug. Could you please share a demo app to reproduce?

Thanks for the response StePhane. I can do better, I can share the actual app in Live, but will have to be over email than on this group. Can you please send me your email? Will that be okay?

Cheers,
Raj

Sure