HTTP2 not working with SSE

package simulations

import io.gatling.core.Predef.*
import io.gatling.core.session
import io.gatling.http.Predef.*

import scala.language.postfixOps
import scala.util.Random

class ssetest extends Simulation {

  val httpProtocol = http.baseUrl("https://localhost:8443")
    .http2PriorKnowledge(Map("localhost:8443" -> true))

  val scn = scenario("ServerSentEvents")
        sse("GET messages")
          .header("MemberId", session => String.valueOf(session.userId))
            sse.checkMessage("ConnectionCheck").matching(substring("connection established"))



I am using the above code to open up SSE connections locally.

Problem Statement: HTTP/2 is not working. It always falls back to HTTP/1.1

On the other hand, if I use http.get(url) instead of sse.connect(url), it is able to establish HTTP/2 connection.

Anything I am missing here?

Indeed, Gatling’s SSE support doesn’t support HTTP/2 atm, only HTTP/1.1.

Is this something that’s critical for your organization and that you’d be willing to contribute or sponsor?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.