Kweb

Constructors

Link copied to clipboard
constructor(port: Int, debug: Boolean = true, plugins: List<KwebPlugin> = Collections.emptyList(), httpsConfig: EngineSSLConnectorConfig? = null, kwebConfig: KwebConfiguration = KwebDefaultConfiguration(), buildPage: WebBrowser.() -> Unit)

The core kwebserver, and the starting point for almost any Kweb app. This will create a HTTP server and respond with a javascript page which will establish a websocket connection to retrieve and send instructions and data between browser and server.

Types

Link copied to clipboard
object Feature : BaseApplicationPlugin<Application, Kweb.Feature.Configuration, Kweb>

If you have an existing Ktor server, you can use the Kweb class as a feature. Adding this to your code is easy:

Properties

Link copied to clipboard

The state of "clients", each representing a webbrowser session.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun addCallback(sessionId: String, callbackId: Int, callback: (JsonElement) -> Unit)
Link copied to clipboard
fun callJs(sessionId: String, funcCall: FunctionCall, debugInfo: DebugInfo? = null)
Link copied to clipboard
open override fun close()
Link copied to clipboard
fun determineClientPrefix(call: ApplicationCall): String
Link copied to clipboard

Forces all currently connected clients to refresh their pages. This can be useful if there has been a code-change, for example.

Link copied to clipboard
fun removeCallback(clientId: String, callbackId: Int)
Link copied to clipboard
suspend fun respondKweb(call: ApplicationCall, buildPage: WebBrowser.() -> Unit)
Link copied to clipboard
fun sendMessage(sessionId: String, server2ClientMessage: Server2ClientMessage)