read

suspend fun <R> read(
    id: String,
    consumer: suspend (ByteReadChannel) -> R
): R

Overrides SessionStorage.read

Reads session id using a consumer as R

This method calls the consumer with a ByteReadChannel and it is in charge of the channel’s lifecycle, and returns the object R produced by the consumer. consumer should read the content of the specified ByteReadChannel and return an object of type R.

Exceptions

NoSuchElementException - when session id is not found.

Return instance of R representing the session object returned from the consumer.