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

org.jetbrains.kotlinx.jupyter.messaging.defaultCommHandlers.kt Maven / Gradle / Ivy

package org.jetbrains.kotlinx.jupyter.messaging

import kotlinx.serialization.json.JsonObject
import org.jetbrains.kotlinx.jupyter.ReplForJupyterImpl
import org.jetbrains.kotlinx.jupyter.api.libraries.Comm
import org.jetbrains.kotlinx.jupyter.api.libraries.sendData
import org.jetbrains.kotlinx.jupyter.messaging.ProvidedCommMessages.OPEN_DEBUG_PORT_TARGET

interface CommHandler {
    val targetId: String

    fun onReceive(comm: Comm, messageContent: JsonObject, repl: ReplForJupyterImpl)
}

class DebugPortCommHandler : CommHandler {
    override val targetId: String
        get() = OPEN_DEBUG_PORT_TARGET

    override fun onReceive(comm: Comm, messageContent: JsonObject, repl: ReplForJupyterImpl) {
        comm.sendData(OpenDebugPortReply(repl.debugPort))
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy