com.hexagonkt.http.model.ServerEvent.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of http Show documentation
Show all versions of http Show documentation
HTTP classes. These classes are shared among the HTTP client and the HTTP server.
The newest version!
package com.hexagonkt.http.model
data class ServerEvent(
val event: String? = null,
val data: String? = null,
val id: String? = null,
val retry: Long? = null,
) {
val eventData: String by lazy {
if (event == null && data == null && id == null && retry == null)
":\n\n"
else
listOf(
"event" to event,
"data" to data,
"id" to id,
"retry" to retry,
)
.filter { it.second != null }
.joinToString("\n", postfix = "\n\n") { (k, v) -> "$k: $v" }
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy