RequestHandlerExtra

Extra data given to request handlers.

One instance exists per in-flight inbound request. It is passed as the second parameter to low-level handlers registered via Protocol.setRequestHandler and installed into the handler coroutine's CoroutineContext, so code nested anywhere under the handler can reach it via currentRequestHandlerExtra without parameter plumbing.

Types

Link copied to clipboard

Context key for retrieving the extra from a handler coroutine's context.

Properties

Link copied to clipboard
open override val key: CoroutineContext.Key<*>
Link copied to clipboard

the request's method

Link copied to clipboard

the JSON-RPC id of the request being handled

Functions

Link copied to clipboard
open override fun <R> fold(initial: R, operation: (R, CoroutineContext.Element) -> R): R
Link copied to clipboard
open operator override fun <E : CoroutineContext.Element> get(key: CoroutineContext.Key<E>): E?
Link copied to clipboard
open override fun minusKey(key: CoroutineContext.Key<*>): CoroutineContext
Link copied to clipboard
open operator fun plus(context: CoroutineContext): CoroutineContext
Link copied to clipboard
suspend fun sendNotification(notification: Notification)

Sends a notification tagged with relatedRequestId = requestId, letting transports associate it with the request being handled (e.g. route it onto the request's SSE stream).

Link copied to clipboard
suspend fun <T : RequestResult> sendRequest(request: Request, options: RequestOptions? = null): T

Sends a request to the peer tagged with relatedRequestId = requestId.