All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hexagonkt.http.model.ServerEvent.kt Maven / Gradle / Ivy

Go to download

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