Package com.rnett.krosstalk.server.plugin

APIs for defining server plugins. For an example, see the Krosstalk Ktor server.

For instructions on writing plugins, see WRITING_PLUGINS.md.

Types

Link copied to clipboard
class KrosstalkResponse(statusCode: Int, contentType: String?, responseHeaders: Headers, responseBody: ByteArray)

A response to send from the server. Should not set content type if contentType is null.

Link copied to clipboard
interface ServerHandler<S : ServerScope<*>>

A Krosstalk server handler. Should help you set up receiver endpoints for all Krosstalk methods (Krosstalk.methods), which should each call handle for their method. No behavior is defined here as what is necessary to do that, and where and how you will want to call it, will vary widely depending on which server you are using.

Functions

Link copied to clipboard
inline suspend fun <K : Krosstalk, KrosstalkServer<*>> K.handle(serverUrl: String, method: MethodDefinition<*>, requestHeaders: Headers, urlArguments: Map<String, String>, requestBody: ByteArray, scopes: WantedScopes, handleException: (Throwable) -> Unit = { throw it }, sendResponse: (KrosstalkResponse) -> Unit)

Helper method for server side to handle a request for a Krosstalk method.

Link copied to clipboard
@JvmName(name = "serverScopesAsType")
fun <S : ServerScope<*>, K : Krosstalk, KrosstalkServer<S>> K.scopesAsType(scopes: Iterable<Scope>): List<S>

Properties

Link copied to clipboard
val <S : ServerScope<*>, K : Krosstalk, KrosstalkServer<S>> K.serverScopes: List<S>