how to keep listening on a websocket without sending anything?

my websocket is used for push message, but do not deal with anything received from client,
in this case ,how can i keep listening on it?

I think that your Gatling script will “keep listening” after opening and until you close (or end the script).
So I think that everything between
e.g. exec(ws(“Connect WS”).open("/room/chat?username=steph")) and until e.g. exec(ws(“Close WS”).close) then Gatling will be “listening”.

What I am less clear on is whether Gatling actually pulls/takes messages from the server when only doing a listen, or whether you need to do a .check(wsListen.
See https://gatling.io/docs/current/http/websocket/ and my similar and (unanswered) question at https://groups.google.com/forum/#!searchin/gatling/sse|sort:date/gatling/AUaGEtu9sgQ/15P_Jf3fAwAJ

Cheers,
Dave.

yeh,same question,need help ~

在 2018年6月15日星期五 UTC+8上午12:00:19,David Miller写道:

hey,David
maybe it works some time:

val listener = scenario("listener")
  .exec(
    ws("Connect WS")
      .wsName("someName")
      .open("/sb/?port=9543")
      .headers(socketHeaders)
  )
  .forever(
    exec(
      ws("Keep Listening").wsName("someName")
        .check(wsAwait.within(50000).until(1))
    )
  )

output like this ,is it means “keep listening” works?

but i got a new problem,when i add a jsonpath to check the message content send by server

val listener = scenario("listener")
  .exec(
    ws("Connect WS")
      .wsName("someName")
      .open("/sb/?port=9543")
      .headers(socketHeaders)
  )
  .forever(
    exec(
      ws("Keep Listening").wsName("someName")
        .check(wsAwait.within(50000).until(1)
          .jsonPath("$..error_code").exists
        )
    )
  )

no keep listening requests list in the output

在 2018年6月15日星期五 UTC+8上午12:00:19,David Miller写道:

ahhhh…I am so silly, wait time too long
when i set it properly, the keep listening request can be list in output.
i guess sse maybe deal with the same way , try it

Hi Ethan,
Thanks for posting this info :slight_smile:
Thanks,
Dave