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


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.


NoSuchElementException - when session id is not found.

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