applying a check to an SSE message

I'm trying to construct a check on a test over server sent events, to test that they were received within a short timeframe.

I started with a simple check, using a regex. This completes with success when the message arrives.
.check(wsAwait.within(15 seconds).until(1).regex("""timestamp"""))

However, I've failed to get a more complex check to work, which examines the message body to extract a "sent" timestamp from the message and compare with the received time:

.check(wsAwait.within(15 seconds).until(1).jsonPath("$.data.timestamp").ofType[Long].transform( ts => java.lang.System.currentTimeMillis() - ts ).lessThan(5000L))

In this case, the check just times-out. I changed the final assertion to 'greaterThan()' and it still fails.

The messages are received ok (by switching debug on for the SSE agent).

*Received message '{"data":"{"user_id":"51d04790-df95-3bca-8c83-a5af6748a1ff","timestamp":1511434385963,"payload":{"@type":"DocumentNotificationPayload","document_id":"de670ed1-1a96-325b-9d77-95fbf7d96123","event_type":"updated","last_modified_timestamp":1511434385963}}"}'*

So I'm sure the jsonPath is correct, and I'm marshalling it correctly.


Sorry forgot to say this is Gatling 2.2.4.

A bit more context…

  .header("Authorization", "${authHeader}")

Ok, i worked around the problem by using a regexp over the JSON, although it’s pretty fragile.