Jellyfin Qt
QML Library for interacting with the Jellyfin multimedia server
Loading...
Searching...
No Matches
Jellyfin::WebSocket Class Reference

Keeps a connection with the Jellyfin server to receive real time updates. More...

#include <websocket.h>

Inheritance diagram for Jellyfin::WebSocket:

Public Types

enum  MessageType {
  ForceKeepAlive , KeepAlive , UserDataChanged , SessionsStart ,
  SessionsStop , Sessions
}
 

Public Slots

void open ()
 
void subscribeToSessionInfo ()
 
void unsubscribeToSessionInfo ()
 

Signals

void commandReceived (QString command, QVariantMap args)
 
void stateChanged (QAbstractSocket::SocketState newState)
 

Public Member Functions

 WebSocket (ApiClient *client)
 WebSocket creates a webSocket for a Jellyfin server to handle real time updates.
 
QAbstractSocket::SocketState state () const
 

Protected Member Functions

void setupKeepAlive (int data)
 
void sendMessage (MessageType type, QJsonValue data=QJsonValue())
 
QString generateMessageId ()
 

Protected Attributes

ApiClientm_apiClient
 
QWebSocket m_webSocket
 
QTimer m_keepAliveTimer
 
QTimer m_retryTimer
 
int m_reconnectAttempt = 0
 
int m_sessionInfoSubscribeCount = 0
 

Properties

QAbstractSocket::SocketState state
 

Detailed Description

Keeps a connection with the Jellyfin server to receive real time updates.

This class will parse these messages and send them to ApiClient, which will emit signals for the interested classes.

Member Enumeration Documentation

◆ MessageType

Enumerator
ForceKeepAlive 

Server to client: instruct client to send periodical KeepAlive messages.

KeepAlive 

Client to server: keep the connection alive.

UserDataChanged 

Server to client: user data for an item has changed.

SessionsStart 

Client to server: Subscribe to playback update sessions.

SessionsStop 

Client to server: unsubscribe from playback session updates.

Sessions 

Server to client: session information has changed.

Constructor & Destructor Documentation

◆ WebSocket()

Jellyfin::WebSocket::WebSocket ( ApiClient * client)
explicit

WebSocket creates a webSocket for a Jellyfin server to handle real time updates.

Parameters
clientThe client to create the socket for.

The socket will automatically set the ApiClient to its parent.

Member Function Documentation

◆ commandReceived

void Jellyfin::WebSocket::commandReceived ( QString command,
QVariantMap args )
signal

◆ generateMessageId()

QString Jellyfin::WebSocket::generateMessageId ( )
protected

◆ open

void Jellyfin::WebSocket::open ( )
slot

◆ sendMessage()

void Jellyfin::WebSocket::sendMessage ( MessageType type,
QJsonValue data = QJsonValue() )
protected

◆ setupKeepAlive()

void Jellyfin::WebSocket::setupKeepAlive ( int data)
protected

◆ state()

QAbstractSocket::SocketState Jellyfin::WebSocket::state ( ) const
inline

◆ stateChanged

void Jellyfin::WebSocket::stateChanged ( QAbstractSocket::SocketState newState)
signal

◆ subscribeToSessionInfo

void Jellyfin::WebSocket::subscribeToSessionInfo ( )
slot

◆ unsubscribeToSessionInfo

void Jellyfin::WebSocket::unsubscribeToSessionInfo ( )
slot

Member Data Documentation

◆ m_apiClient

ApiClient* Jellyfin::WebSocket::m_apiClient
protected

◆ m_keepAliveTimer

QTimer Jellyfin::WebSocket::m_keepAliveTimer
protected

◆ m_reconnectAttempt

int Jellyfin::WebSocket::m_reconnectAttempt = 0
protected

◆ m_retryTimer

QTimer Jellyfin::WebSocket::m_retryTimer
protected

◆ m_sessionInfoSubscribeCount

int Jellyfin::WebSocket::m_sessionInfoSubscribeCount = 0
protected

◆ m_webSocket

QWebSocket Jellyfin::WebSocket::m_webSocket
protected

Property Documentation

◆ state

QAbstractSocket::SocketState Jellyfin::WebSocket::state
read

The documentation for this class was generated from the following files: