Multiple sync checks on WebSocket

Hi,

I’ve read the post about multiple asynchronous checks on WebSocket connections. As the old post fizzled out a bit I’d like to open another thread (moreover, my issue doesn’t really fit to the old posting topically).

Some background information: I want to loadtest a web application that is based on the Vaadin Framework and uses WebSockets (the implementation is based on the Atmosphere Framework). It is working pretty good so far, although I encounter some issues, but it seems like Vaadin is responsible for these.

When the web application upgrades the HTTP session to WebSockets, I get at least two responses on the WebSocket channel.

  • The first always contains an Atmosphere ID that is used to fully close the WebSocket connection at a later time.

  • The second response contains the actual data for my scenario including another ID.
    For my scenario I need to parse these IDs in their respective WebSocket response to use them at a later time.

Actually I found a way to get this working by defining an asynchronous check on the initial WebSocket request and firing a ‘dummy’ request shortly after the inital one, knowing that the web application has no use with it. Then I define another check on the dummy request that parses my ID. This is only working because I have timeframe of around 2-3 seconds between the two responses. Unfortunately sending this dummy request causes some weird behaviour on the server side and the response times for the rest of the scenario grow by around 1-2 seconds. Therefore this ‘abuse’ is only useful to define a scenario but cannot be used on a real load test.

For clarification, this is the actual code:

`

.exec(
ws(“Open Websocket Channel”)
.open(s"/PUSH? […] “)
.headers(header_websocketInit)
.check(wsListen.within(5 seconds).until(1).regex(Constants.AtmoKey_RegEx).saveAs(Constants.AtmoKey_SaveString)))
.exec(ws(“Retrieve StartRepairButton id”)
.sendText(atmoMessage(”""{“rpc”:[],“syncId”:-1,“clientId”:0}"""))
.check(wsAwait.within(10 seconds).until(1).regex(Constants.ExecuteActionButton_RegEx).saveAs(Constants.ExecuteActionButton_SaveString)))

`

A real solution for my issue would be to define my two synchronous checks on the first request that initially opens the WebSocket channel:

`

.exec(
ws(“Open Websocket Channel”)
.open(s"/PUSH? […] ")
.headers(header_websocketInit)
.check(wsAwait.within(10 seconds).until(1).regex(Constants.AtmoKey_RegEx).saveAs(Constants.AtmoKey_SaveString))
.check(wsAwait.within(10 seconds).until(1).regex(Constants.ExecuteActionButton_RegEx).saveAs(Constants.ExecuteActionButton_SaveString)))

`

Considering that Vaadin is a pretty popular framework for web applications I think that this use case might become pretty common in the future.