examples Protocols
sse_scripted.http
An SSE feed checked by captures and @assert.
runs as-is
resterm run _examples/sse_scripted.httpRun this from the root of a clone of the Resterm repository.
Editor
WebSocket and SSE docs### Scripted SSE Monitor
# @name SSEScriptedMonitor
# @sse idle=5s duration=20s max-events=5
# @assert stream.enabled() => "stream should be enabled"
# @assert len(stream.events()) > 0 => "expected at least one SSE event"
# @assert stream.summary().eventCount > 0 => "summary tracks event count"
# Wikimedia starts every stream with an "ok" comment, so the first data event
# is at index 1.
# @capture request firstEvent {{stream.events[1].data}}
# @capture file lastReason {{stream.summary.reason}}
GET https://stream.wikimedia.org/v2/stream/recentchange
User-Agent: resterm-examples (https://github.com/unkn0wn-root/resterm)