Measure WebSocket
facts.measure.wsMeasure WebSocket message timing from the server's network position: connect, listen for a set duration, and return received messages with absolute timestamps and offsets.
Instructions
Connect to a WebSocket, listen for a given number of seconds, and return the messages that arrived, each with its absolute time and its offset from the open. Measures from the server's network position. Zero messages is a valid observation, not an error: it does NOT wait for a particular message, does not interpret payloads, does not reconnect, and does not say whether silence is a problem.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| url | Yes | ws:// or wss:// URL. Subject to the network policy. | |
| send | No | Messages to send once the socket is open. | |
| headers | No | Handshake headers, e.g. auth. | |
| project | Yes | Project this observation belongs to. | |
| max_messages | No | Stop recording received messages at this many; listening continues for the full time. Does not count your own send messages. | |
| subprotocols | No | Requested subprotocols. | |
| listen_seconds | Yes | How long to listen. The full time is always served unless the peer closes. | |
| max_total_bytes | No | Aggregate cap across received messages. | |
| max_message_bytes | No | Per-message cap; larger payloads are truncated. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | Whether the observation could be taken. NOT a judgement about what was observed: a cleanly received HTTP 500 is ok:true. | |
| data | Yes | The raw observation, or null when error is set. | |
| tool | Yes | Full tool name. | |
| error | Yes | What prevented observing, if anything. | |
| target | Yes | Effective arguments, redacted. | |
| project | Yes | The normalized project. | |
| warnings | Yes | Non-fatal notices. | |
| age_basis | Yes | Which clock the age came from. | |
| request_id | Yes | The request that produced it. | |
| age_seconds | Yes | Seconds since observed_at. | |
| duration_ms | Yes | How long the observation took. | |
| observed_at | Yes | ISO 8601 with offset. | |
| observation_id | Yes | Citable id of this observation. |