Use this file to discover all available pages before exploring further.
Gatling’s Server-Sent Events (SSE) support is an extension to the HTTP SDK that lets you load test streaming APIs that push real-time updates to clients. SSE is a unidirectional protocol: the server continuously sends events over a persistent HTTP connection, and the client only reads. Gatling models this as a separate branch within your scenario—running in parallel with regular HTTP actions—making it ideal for testing notification systems, live dashboards, stock feeds, and other push-based applications. The entry point for all SSE actions is sse("actionName").
When a virtual user must maintain more than one SSE stream at the same time, assign a distinct name to each stream and reference it on every subsequent action:
Open an SSE stream with get (for GET requests) or post (for POST requests). Gatling automatically sets the Accept: text/event-stream and Cache-Control: no-cache headers required by the SSE specification.Both GET and POST are supported:
Java
// GET (most common for SSE)exec(sse("subscribe updates").get("/updates"))// POST with a request bodyexec(sse("subscribe filtered").post("/events").body(StringBody("{\"filter\": \"#{category\"}"))))
SSE checks validate incoming stream events. Gatling currently supports only blocking checks: the virtual user pauses until a matching event arrives or the timeout expires.
When a check is applied, Gatling parses the raw SSE event into a JSON object, giving you access to all standard SSE fields via jsonPath or jmesPath. For example, the event:
Use sse.checkMessage("checkName") to create a check definition. The full set of Gatling HTTP check criteria is available, including jsonPath, jmesPath, bodyString, substring, and saveAs.
Events that arrive but are not matched by any active check can be buffered for later processing. Enable buffering by setting sseUnmatchedInboundMessageBufferSize on the HTTP protocol:
Call sse.processUnmatchedMessages on the sse DSL object (not on a named action):
Java
sse.processUnmatchedMessages((messages, session) -> { // messages are sorted oldest-first (SseInboundMessage instances) // each message is the JSON string representation of the event return session.set("bufferedEventCount", messages.size());})
The following example simulates users connecting to a stock market SSE feed, waiting for a snapshot event, then periodically checking for price updates.