AusweisApp2
WebSocketChannel.h
gehe zur Dokumentation dieser Datei
1 
7 #pragma once
8 
9 #include "DataChannel.h"
10 
11 #include <QByteArray>
12 #include <QObject>
13 #include <QTimer>
14 #include <QWebSocket>
15 
16 namespace governikus
17 {
19  : public DataChannel
20 {
21  Q_OBJECT
22 
23  private:
24  const QSharedPointer<QWebSocket> mConnection;
25  const QString mId;
26  QTimer mPingTimer;
27  QTimer mPongTimer;
28  static QString makeConnectionId(const QSharedPointer<QWebSocket>& pConnection);
29 
30  public:
31  explicit WebSocketChannel(const QSharedPointer<QWebSocket>& pConnection);
32  ~WebSocketChannel() override;
33 
34  void send(const QByteArray& pDataBlock) override;
35  void close() override;
36  [[nodiscard]] const QString& getId() const override;
37 
38  private Q_SLOTS:
39  void onReceived(const QString& pMessage);
40  void onDisconnected();
41  void onPingScheduled();
42  void onPongReceived();
43  void onPongTimeout();
44 };
45 
46 } // namespace governikus
Definition: DataChannel.h:19
Definition: WebSocketChannel.h:20
~WebSocketChannel() override
Definition: WebSocketChannel.cpp:58
void send(const QByteArray &pDataBlock) override
Definition: WebSocketChannel.cpp:71
void close() override
Definition: WebSocketChannel.cpp:80
WebSocketChannel(const QSharedPointer< QWebSocket > &pConnection)
Definition: WebSocketChannel.cpp:35
const QString & getId() const override
Definition: WebSocketChannel.cpp:97
A simple template renderer.
Definition: ActivationContext.h:15