KwebDefaultConfiguration

A default KwebConfiguration using runtime arguments

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override val buildpageTimeout: Duration

If Kweb.debug is enabled, then pages that take longer than buildpageTimeout to load will display a warning message

Link copied to clipboard

Message that is shown to a disconnected client.

Link copied to clipboard
open override val clientStateStatsEnabled: Boolean

Enable stats for the client state cache. Small performance penalty per operation, large gains in observability. Consider this in production.

Link copied to clipboard
open override val clientStateTimeout: Duration

Clients that last connected more than clientStateTimeout will be cleaned up every minute.

Link copied to clipboard
open val handleFavicon: Boolean = true

If true, Kweb will handle favicon requests via a default plugin added if and only if no existing FaviconPlugin is found in the list of plugins. If false the user should add their own FaviconPlugin or handle favicon requests some other way (perhaps directly with Ktor).

Link copied to clipboard

By default, Kweb will handle all paths under /, but this may not be desirable if you have other Ktor route handlers. This config option allows you to add a prefix to the Kweb route handler, e.g. /my_kweb_site, so that only URLs under that path will be handled by Kweb.

Functions

Link copied to clipboard

Override this function to handle uncaught exceptions of client callbacks. E.g. if the browser sends a websocket message back to the kweb instance and the message handler throws an uncaught exception, kweb will invoke this exception handler to expose the fact that a message could not be properly handled

Link copied to clipboard
fun validate()

Values are initialized eagerly, but objects are not, so be sure to "touch" this class on initialization for failing fast.