All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.org.jellyfin.sdk.api.sockets.SocketConnectionState.kt Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
package org.jellyfin.sdk.api.sockets

/**
 * Possible states for a [SocketConnection]. This will start out as [Disconnected] with no error set and switch to
 * [Connecting] when attempting to initialize a session. The [Message] state means that the socket is connected.
 *
 * The server is always the first to send a message, so we don't have an intermediate state between [Connecting] and
 * [Message].
 */
public sealed class SocketConnectionState {
	/**
	 * There is no current connection. This is the default state.
	 */
	public data class Disconnected(val error: Throwable? = null) : SocketConnectionState()

	/**
	 * A connection is currently in progress.
	 */
	public data object Connecting : SocketConnectionState()

	/**
	 * The last received message in an active connection.
	 */
	public data class Message(val message: String) : SocketConnectionState()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy