KUnifiedPush

serversenteventsstream.h
1/*
2 SPDX-FileCopyrightText: 2022 Volker Krause <vkrause@kde.org>
3 SPDX-License-Identifier: LGPL-2.0-or-later
4*/
5
6#ifndef KUNIFIEDPUSH_SERVERSENTEVENTSSTREAM_H
7#define KUNIFIEDPUSH_SERVERSENTEVENTSSTREAM_H
8
9#include <QObject>
10
11class QIODevice;
12
13namespace KUnifiedPush {
14
15class SSEMessage
16{
17public:
18 QByteArray event;
19 QByteArray data;
20};
21
22/** Sever-sent Events (SSE) stream
23 * @see https://en.wikipedia.org/wiki/Server-sent_events
24 */
26{
28public:
29 explicit ServerSentEventsStream(QObject *parent = nullptr);
31
32 void read(QIODevice *device);
33
35 void messageReceived(const KUnifiedPush::SSEMessage &msg);
36
37private:
38 void processBuffer();
39
40 QByteArray m_buffer;
41};
42
43}
44
45Q_DECLARE_METATYPE(KUnifiedPush::SSEMessage)
46
47#endif // KUNIFIEDPUSH_SERVERSENTEVENTSSTREAM_H
Sever-sent Events (SSE) stream.
Client-side integration with UnifiedPush.
Definition connector.h:16
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:35 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.