Handling multiple Server-Sent-Events on a single SSE-Stream.

Hey Guys!

I’m very new to gatling. I want to load test my SSE-Applicaiton. I was able to handle the first SSE but unfortunately I can’t figure out how to handle multiple events.

Unfortunately I couldn’t find anything on this topic in the Documentation nor in the web. My application communicates with the Client quite heavily via SSE. The opposite direction is realized via “normal” requests.

following some simplified code:

`

val scn = scenario(“ExampleScenario”)
.exec(
sse(“ExampleSSE”).open("/someURL").check( // [1]
// I know that importantID is in the UUID format so it is fairly easy to parse it with a regex
wsAwait.within(10 seconds).until(1).regex("[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}").find.saveAs(“importantId”) // [2]
)
).exec(
sse(“ExampleSSE”).check(
wsAwait.within(10 seconds).until(1).regex(“isDataRequest”).find.saveAs(“isDataRequest”) // [3]
)
).exec(
http(“SupplyData”)
.post("/anotherURL/${importantId}")
.header(“Content-Type”, “application/json”)
.body(RawFileBody(“dataToSupply.json”)).check( myCheck )
)

`

When I execute this, i get the following error message:

`

21:55:30.350 [ERROR] i.g.h.a.s.SseActor - Discarding unknown message SetCheck(ExampleSSE,WsCheck(CheckBase(,,,Some(isDataRequest)),true,10 seconds,UntilCount(1),1457729730344),Actor[akka://GatlingSystem/user/sessionHook-2#1321766877],Session(ExampleScenario,8851000738354737712-0,Map(gatling.http.sse → Actor[akka://GatlingSystem/user/$a/$a#-1378743835], importantId → 9b89f0b2-9931-41f5-a099-dab8e0aa42bd),1457729729460,0,OK,List(),)) while in open state

`

I’ve tried various combinations in the code and even setting the .sseName(“mySSE”). I couldnt figure out how to do it.
While [1] works like a charm, I am unable to aquire the SSE-Stream in the second .exec.

To make it a little easier to understand and talk about I have created a small sequence diagram for my use case.

[1] first the SSE EventSource is aquired
[2] then an id for this operation is created and returned (via SSE) to the Client
[3] after that my application may request some data from the client (via SSE)
now the client has to react and supply the data with a normal http POST request. Afterwards various events may be send to the Client.

I hope you get what I want and are able to help me.

Best regards,
Senad

@Senad Licina , did you get the solution for the same, because i am also facing the same issue?