Handling incoming web socket messages

Hi all,

Two questions:

Consider the following snippet (please disregard syntax errors :slight_smile: )

.exec(ws(“Send JSON”)
.sendText( “{“message”: “Hello”}”)
.check(wsAwait.within(10).until(1).regex(".response."))

Is there a way I can access the response message I’m waiting for here rather than just check it for regexp ?
Can I store it and use later in some fashion ( parse and send of new messages ) ?

Is it possible to build a web socket based scenario where I open X web sockets and then just wait for incoming messages ?
I.e a listener that receives messages, parse the content and act upon it, e.g sending a message in return on the web socket.

Cheers,

Niklas

Is there a way I can access the response message I'm waiting for here
rather than just check it for regexp ?
Can I store it and use later in some fashion ( parse and send of new
messages ) ?

Yes, standard "saveAs" check step.

2.
Is it possible to build a web socket based scenario where I open X web
sockets and then just wait for incoming messages ?
I.e a listener that receives messages, parse the content and act upon it,
e.g sending a message in return on the web socket.

Yes, a wsAwait check will block the flow until check completion, and then
you can save the message, possibly process it, and decide which next
message to send.