SocketApi

interface SocketApi

The SocketApi maintains a WebSocket connection to the current server specified in its parent ApiClient. Each ApiClient has one SocketApi instance. Updating the server URL, device info, client info or access token using the update function will automatically propagate and reconnect the WebSocket.

The WebSocket automatically disconnects when there are no active subscriptions. Subscriptions will automatically send the appropriate start and stop messages to the server, the start messages will always request an interval of one second. Prefer using individual subscriptions above the subscribeAll function for best performance.

Inheritors

Properties

Link copied to clipboard
abstract val state: ERROR CLASS: Symbol not found for StateFlow<org/jellyfin/sdk/api/sockets/SocketApiState>

Flow indicating the current status of the WebSocket connection.

Functions

Link copied to clipboard
abstract fun <T : ERROR CLASS: Symbol not found for OutboundWebSocketMessage> subscribe(messageType: KClass<T>): ERROR CLASS: Symbol not found for Flow<T>

Subscribe to a specific WebSocket message type.

Link copied to clipboard
inline fun <T : ERROR CLASS: Symbol not found for OutboundWebSocketMessage> SocketApi.subscribe(): ERROR CLASS: Symbol not found for Flow<T>

Subscribe to a specific WebSocket message type.

Link copied to clipboard
abstract fun subscribeAll(): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for OutboundWebSocketMessage>

Subscribe to all incoming WebSocket messages.

Link copied to clipboard
inline fun SocketApi.subscribeGeneralCommand(command: ERROR CLASS: Symbol not found for GeneralCommandType): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for GeneralCommandMessage>

Subscribe to a specific GeneralCommandType message.

Link copied to clipboard
inline fun SocketApi.subscribeGeneralCommands(commands: Set<ERROR CLASS: Symbol not found for GeneralCommandType> = GeneralCommandType.values().toSet()): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for GeneralCommandMessage>

Subscribe to specific GeneralCommandType messages.

Link copied to clipboard
inline fun SocketApi.subscribePlayStateCommand(command: ERROR CLASS: Symbol not found for PlaystateCommand): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for PlaystateMessage>

Subscribe to a specific PlaystateCommand message.

Link copied to clipboard
inline fun SocketApi.subscribePlayStateCommands(commands: Set<ERROR CLASS: Symbol not found for PlaystateCommand> = PlaystateCommand.values().toSet()): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for PlaystateMessage>

Subscribe to specific PlaystateCommand messages.

Link copied to clipboard
inline fun SocketApi.subscribeSyncPlayCommand(command: ERROR CLASS: Symbol not found for SendCommandType): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for SyncPlayCommandMessage>

Subscribe to a specific SendCommandType message.

Link copied to clipboard
inline fun SocketApi.subscribeSyncPlayCommands(commands: Set<ERROR CLASS: Symbol not found for SendCommandType> = SendCommandType.values().toSet()): ERROR CLASS: Symbol not found for Flow<ERROR CLASS: Symbol not found for SyncPlayCommandMessage>

Subscribe to specific SendCommandType messages.