MsmpClient

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val eventFlow: Flow<MsmpEvent>

The event flow.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val stateFlow: StateFlow<MsmpState>

Functions

Link copied to clipboard
inline suspend fun await(): MsmpState.Closed

Awaits the client to be closed. Not actually connection to be closed.

Link copied to clipboard
inline suspend fun <T : MsmpEvent> awaitEvent(): T?

Awaits the first event of type T.

Link copied to clipboard
inline suspend fun <T : MsmpState> awaitState(): T?

Awaits the first client state of type T.

Link copied to clipboard
inline suspend fun <R> call(method: String, timeout: Long = config.requestTimeout): R

Sends a request to the server and awaits a response.

inline suspend fun <P, R> call(method: String, params: P, timeout: Long = config.requestTimeout): R

Sends a request with parameters using automatic serialization.

suspend fun <R> call(method: String, responseSerializer: KSerializer<R>, timeout: Long = config.requestTimeout): R
inline suspend fun <P, R> call(method: String, params: P, paramSerializer: KSerializer<P>, responseSerializer: KSerializer<R>, timeout: Long = config.requestTimeout): R

Sends a request with parameters using a manual serializer.

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun connect()
Link copied to clipboard
inline fun <T : MsmpEvent> on(): Flow<T>

Returns a Flow of events of type T.

inline fun <T : MsmpEvent> on(crossinline block: suspend T.() -> Unit): Job

Subscribes to events of type T.