scoop:scoop.http:0.1.0
src/sse/model.scoop
Selected production source · src/sse/model.scoop
1
package scoop.http3
/**4
* Nonnegative byte limits for an SSE line and accumulated event data.5
*/6
public class SseLimits public constructor(7
/**8
* The maximum byte length of a single event-stream line.9
*/10
public val maxLineBytes: Long = 65536L,11
/**12
* The maximum accumulated event-data byte count.13
*/14
public val maxEventBytes: Long = 1048576L) {15
init {16
if (maxLineBytes < 0L || maxEventBytes < 0L) throw IllegalArgumentException(Some("negative SSE limit"))17
}18
}20
/**21
* The SSE input limit that was exceeded.22
*/23
public enum SseLimitKind {24
/**25
* A single input line exceeded its byte limit.26
*/27
LineBytes,28
/**29
* Accumulated event data exceeded its byte limit.30
*/31
EventBytes }33
/**34
* SSE input exceeded the named configured byte limit.35
*/36
public class SseLimitException public constructor(37
/**38
* The configured limit category that was exceeded.39
*/40
public val kind: SseLimitKind,41
/**42
* The configured maximum for that category.43
*/44
public val limit: Long)45
: Exception(Some("SSE " + (if (kind == SseLimitKind.LineBytes) "line" else "event data") + " exceeds " + limit.toString() + " bytes"))47
/**48
* One dispatched server-sent event, including its type, joined data lines, and event-ID state.49
*/50
public class SseEvent internal constructor(51
/**52
* The dispatched event type, defaulting to message.53
*/54
public val event: String,55
/**56
* Data lines joined with newline separators.57
*/58
public val data: String,59
/**60
* The ID explicitly set in this event, if any.61
*/62
public val id: String?,63
/**64
* The persistent last-event ID when this event was dispatched.65
*/66
public val lastEventId: String67
)