Kotlin: Stream.awaitOpen()

DESCRIPTION

Open a Stream.

This function is meant to be used in a Kotlin coroutine to suspend execution until the stream is open or an error occurs.

DECLARATION

suspend fun Stream.awaitOpen(
    port: Int,
    ) 

PARAMETERS

port:
The stream port to use on the remote server, a streamport is a demultiplexing id.

THROWS EXCEPTIONS

NabtoRuntimeException:
with error code STOPPED if the stream or a parent object was stopped.
NabtoRuntimeException:
with error code NOT_CONNECTED if the connection is not established yet.