we really struggle accomplishing our first successful message receive with Gatling talking to a server side receiving Websocket / STOMP in a Spring Boot application.
The test scenario looks like this:
val httpConf = http
val getLoggedInUser =
val scn = scenario("test1")
.exec(ws("connect to websocket").open("/wdp3websocketendpoint/websocket"))
and running this scenario always ends up in “Check failed: Timeout” message. Examining the server logs I see the request message received on Websocket and the response message getting sent there too but Gatling doesn’t seem to pick up anything on the channel.
What could be missing here?
Thanks in advance,
Replying to my own question, we were lacking a few necessary steps indeed. As the server side tries to use the STOMP protocol, we needed to send Websocket messages for Stomp CONNECT and SUBSCRIBE commands in order to receive valid response messages to sent requests.
Hope it helps someone - and sorry for the noise.
I am facing the same problem. I am not familiar enough with STOMP protocol, so could you explain more how you did it?
Thanks and regards.
Nice to meet some people dealing with this protocol too =)
Here are some docs about the protocol: https://stomp.github.io
That’s how I’m working with it:
- Open websocket connection
- Send CONNECT frame. It should look something like this: val connectFrame = “[“CONNECT\naccept-version:1.1,1.0\nheart-beat:0,0\n\n\u0000”]”
- Wait for connected response: frame will contain something like "“CONNECTED\nversion:1.1\nheart-beat:0,0…”
- First of all you need to find out what destinations your app has and subscribe to ones you want to listen to. Subscription frame looks like this: val subscr = “[“SUBSCRIBE\nid:sub-1\ndestination:/some/destination\n\n\u0000”]”, where sub-1 is an index of you subscription that you can later use to unsubscribe.
- Now you can send messages and receive responses. SEND frames should include a content-length header if a body is present, make sure to calculate it properly.
If you deal with some web app, it is a good idea to explore websocket frames in browser. In Chrome developer tools: Network, filter by WS and see frames tab for your connection, they are all displayed fine.
Hope this helps.
Hi and nice to meet you too,
Also thanks for your quick reply.
I have another problem that I cannot open even open web-socket connection This is how I try to do it:
and I have configured http as follow:
Not sure if .basicAuth() can be used for websocket connections in Gatling. You can try to pass username and password as a part of url string OR send login and password in CONNECT frame headers (depending on implementation you’re dealing with).
And yes, status you are expecting is 101.
As for spring boot configs, I’m not familiar with it.