Skip to main content

WebSocket

Source file: examples/ws_protocol.hen

What It Demonstrates

  • protocol = ws
  • a session-opening request
  • a later session-backed send step
  • capturing the reply body from the message exchange flow

Key Pattern

protocol = ws
session = chat
GET {{ WS_ORIGIN }}/ws

---

session = chat
within = 1s

~~~
<Root seed="0">
<Document>
<Text>
1. Sentence:
<Sentence min="3" max="10"/>
</Text>
</Document>
</Root>
~~~

Run It

hen verify ./examples/ws_protocol.hen
hen run ./examples/ws_protocol.hen all --non-interactive

What To Notice

  • The session-opening step establishes the WebSocket connection.
  • The later body-backed step reuses that session.
  • In the current example, the received body is captured for callback output rather than asserted.

Related reference: Protocols