19#ifndef JELLYFIN_WEBSOCKET_H
20#define JELLYFIN_WEBSOCKET_H
22#include <QJsonDocument>
32#include <QtWebSockets/QWebSocket>
43 class UserItemDataDto;
91 QAbstractSocket::SocketState
state()
const {
99 void textMessageReceived(
const QString &message);
101 void onDisconnected();
103 void sendKeepAlive();
104 void onWebsocketStateChanged(QAbstractSocket::SocketState newState) { emit
stateChanged(newState); }
An Api client for Jellyfin. Handles requests and authentication.
Definition apiclient.h:90
Keeps a connection with the Jellyfin server to receive real time updates.
Definition websocket.h:52
WebSocket(ApiClient *client)
WebSocket creates a webSocket for a Jellyfin server to handle real time updates.
Definition websocket.cpp:32
void stateChanged(QAbstractSocket::SocketState newState)
void open()
Definition websocket.cpp:55
QTimer m_keepAliveTimer
Definition websocket.h:113
void commandReceived(QString command, QVariantMap args)
int m_sessionInfoSubscribeCount
Definition websocket.h:116
ApiClient * m_apiClient
Definition websocket.h:110
MessageType
Definition websocket.h:62
@ UserDataChanged
Server to client: user data for an item has changed.
Definition websocket.h:74
@ ForceKeepAlive
Server to client: instruct client to send periodical KeepAlive messages.
Definition websocket.h:66
@ SessionsStop
Client to server: unsubscribe from playback session updates.
Definition websocket.h:82
@ KeepAlive
Client to server: keep the connection alive.
Definition websocket.h:70
@ Sessions
Server to client: session information has changed.
Definition websocket.h:86
@ SessionsStart
Client to server: Subscribe to playback update sessions.
Definition websocket.h:78
QAbstractSocket::SocketState state
Definition websocket.h:88
QWebSocket m_webSocket
Definition websocket.h:111
void setupKeepAlive(int data)
Definition websocket.cpp:176
int m_reconnectAttempt
Definition websocket.h:115
void unsubscribeToSessionInfo()
Definition websocket.cpp:77
QString generateMessageId()
Definition websocket.cpp:184
void sendMessage(MessageType type, QJsonValue data=QJsonValue())
Definition websocket.cpp:188
void subscribeToSessionInfo()
Definition websocket.cpp:68
QTimer m_retryTimer
Definition websocket.h:114
UserItemDataDto UserData
Definition apiclient.h:58
Q_DECLARE_LOGGING_CATEGORY(jellyfinWebSocket)