9#include <TWebSocketSession>
17 QString className()
const;
19 void sendText(
const QString &text);
20 void sendBinary(
const QByteArray &binary);
21 void ping(
const QByteArray &payload = QByteArray());
22 void sendPing(
const QByteArray &payload = QByteArray());
24 void sendText(
int sid,
const QString &text);
25 void sendBinary(
int sid,
const QByteArray &binary);
27 void rollbackTransaction();
28 void subscribe(
const QString &topic,
bool local =
true);
29 void unsubscribe(
const QString &topic);
30 void unsubscribeFromAll();
31 void publish(
const QString &topic,
const QString &text);
32 void publish(
const QString &topic,
const QByteArray &binary);
33 void startKeepAlive(
int interval);
39 uint16_t
peerPort()
const {
return peerPortNumber; }
42 static bool isUserLoggedIn(
const TSession &session);
43 static QString identityKeyOfLoginUser(
const TSession &session);
44 static const QStringList &disabledEndpoints();
47 virtual bool onOpen(
const TSession &session);
48 virtual void onClose(
int closeCode);
49 virtual void onTextReceived(
const QString &text);
50 virtual void onBinaryReceived(
const QByteArray &binary);
51 virtual void onPing(
const QByteArray &payload);
52 virtual void onPong(
const QByteArray &payload);
54 virtual bool transactionEnabled()
const;
55 void sendPong(
const QByteArray &payload = QByteArray());
78 bool rollbackRequested()
const;
81 QList<QPair<int, QVariant>> taskList;
82 bool rollback {
false};
83 QHostAddress peerAddr;
84 uint16_t peerPortNumber {0};
86 friend class TWebSocketWorker;
94 return QString(metaObject()->
className());
102inline bool TWebSocketEndpoint::rollbackRequested()
const
The TSession class holds information associated with individual visitors.
Definition tsession.h:7
The TWebSocketEndpoint is the base class of endpoints for WebSocket communication.
Definition twebsocketendpoint.h:12
uint16_t peerPort() const
Definition twebsocketendpoint.h:39
virtual ~TWebSocketEndpoint()
Definition twebsocketendpoint.h:15
void rollbackTransaction()
This function is called to rollback a transaction on the database.
Definition twebsocketendpoint.h:97
QHostAddress peerAddress() const
Definition twebsocketendpoint.h:38
const TWebSocketSession & session() const
Returns the current WebSocket session, allows associating information with individual visitors.
Definition twebsocketendpoint.h:35
TWebSocketSession & session()
Returns the current WebSocket session, allows associating information with individual visitors.
Definition twebsocketendpoint.h:36
virtual bool transactionEnabled() const
Must be overridden by subclasses to disable transaction mechanism.
Definition twebsocketendpoint.h:107
QString className() const
Returns the class name.
Definition twebsocketendpoint.h:92
virtual int keepAliveInterval() const
Definition twebsocketendpoint.h:53
The TWebSocketSession class holds information associated with individual visitors for WebSocket conne...
Definition twebsocketsession.h:8
@ NormalClosure
Definition tfnamespace.h:213
#define T_CORE_EXPORT
Definition tdeclexport.h:28
#define T_DISABLE_COPY(Class)
Definition tdeclexport.h:37
#define T_DISABLE_MOVE(Class)
Definition tdeclexport.h:41