Comm

interface Comm

Properties

Link copied to clipboard
abstract val id: String

Comm ID

Link copied to clipboard
abstract val target: String

Comm target name

Functions

Link copied to clipboard
abstract fun close(data: JsonObject = Json.EMPTY, notifyClient: Boolean = true)

Closes a comm. Sends comm_close request to frontend if notifyClient is true

Link copied to clipboard

Adds action callback for comm_close requests. Does not override existing callbacks

Link copied to clipboard
inline fun <T> Comm.onData(crossinline action: (T) -> Unit): CommMsgCallback
Link copied to clipboard

Add action callback for comm_msg requests. Doesn't override existing callbacks

Link copied to clipboard
abstract fun removeCloseCallback(callback: CommCloseCallback)

Remove added onClose callback

Link copied to clipboard
abstract fun removeMessageCallback(callback: CommMsgCallback)

Remove added onMessage callback

Link copied to clipboard
abstract fun send(data: JsonObject)

Send JSON data to this comm. Effectively sends comm_msg message to frontend

Link copied to clipboard
inline fun <T> Comm.sendData(data: T)

Send an object. data should be serializable to JSON object (generally it means that the corresponding class should be marked with @Serializable)