handle
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)
Content copied to clipboard
Helper method for server side to handle a request for a Krosstalk method.
Parameters
serverUrl
the base url of the server, not including the method's endpoint.
method
method to call
requestHeaders
the headers of the request
urlArguments
the arguments gotten from the URL (probably using the endpoint's resolver)
requestBody
the body of the request
scopes
the scopes gotten from the request. Missing required scopes will be handled here.
handleException
how to handle a server exception, if requested. Should log if possible, throw if not.
sendResponse
a lambda to respond to the request.