Torc
0.1
|
Overlays the Websocket protocol over a QTcpSocket. More...
#include <torcwebsocket.h>
Public Types | |
enum | SocketState { DisconnectedSt = (0 << 0), ConnectingTo = (1 << 1), ConnectedTo = (1 << 2), Upgrading = (1 << 3), Upgraded = (1 << 4), Disconnecting = (1 << 5), ErroredSt = (1 << 6) } |
Public Slots | |
void | Start (void) |
Initialise the websocket once its parent thread is ready. More... | |
void | CloseSocket (void) |
void | PropertyChanged (void) |
Receives notifications when a property for a subscribed service has changed. More... | |
bool | HandleNotification (const QString &Method) |
void | RemoteRequest (TorcRPCRequest *Request) |
Initiate a Remote Procedure Call. More... | |
void | CancelRequest (TorcRPCRequest *Request) |
Cancel a Remote Procedure Call. More... | |
void | Encrypted (void) |
void | SSLErrors (const QList< QSslError > &Errors) |
Signals | |
void | ConnectionEstablished (void) |
void | ConnectionUpgraded (void) |
void | Disconnected (void) |
void | Disconnect (void) |
Public Member Functions | |
TorcWebSocket (TorcWebSocketThread *Parent, qintptr SocketDescriptor, bool Secure) | |
TorcWebSocket (TorcWebSocketThread *Parent, const QHostAddress &Address, quint16 Port, bool Secure, TorcWebSocketReader::WSSubProtocol Protocol=TorcWebSocketReader::SubProtocolJSONRPC) | |
~TorcWebSocket () | |
bool | IsSecure (void) |
Static Public Member Functions | |
static QVariantList | GetSupportedSubProtocols (void) |
Return a list of supported WebSocket sub-protocols. More... | |
Protected Slots | |
void | ReadyRead (void) |
Process incoming data. More... | |
void | Connected (void) |
void | Error (QAbstractSocket::SocketError) |
void | SubscriberDeleted (QObject *Subscriber) |
A subscriber object has been deleted. More... | |
void | TimedOut (void) |
void | BytesWritten (qint64) |
Protected Member Functions | |
bool | event (QEvent *Event) override |
Overlays the Websocket protocol over a QTcpSocket.
TorcWebSocket is NOT thread safe. It will make direct function calls to registered services - which must ensure those functions are thread safe. Likewise RemoteRequest etc can be called from any thread. For thread safe operation - use TorcWebSocketThread.
Limit frame size for reading
Fix testsuite partial failures (fail fast on invalid UTF-8)
Add timeout for response to upgrade request
Definition at line 23 of file torcwebsocket.h.
Enumerator | |
---|---|
DisconnectedSt | |
ConnectingTo | |
ConnectedTo | |
Upgrading | |
Upgraded | |
Disconnecting | |
ErroredSt |
Definition at line 28 of file torcwebsocket.h.
TorcWebSocket::TorcWebSocket | ( | TorcWebSocketThread * | Parent, |
qintptr | SocketDescriptor, | ||
bool | Secure | ||
) |
Definition at line 62 of file torcwebsocket.cpp.
TorcWebSocket::TorcWebSocket | ( | TorcWebSocketThread * | Parent, |
const QHostAddress & | Address, | ||
quint16 | Port, | ||
bool | Secure, | ||
TorcWebSocketReader::WSSubProtocol | Protocol = TorcWebSocketReader::SubProtocolJSONRPC |
||
) |
Definition at line 88 of file torcwebsocket.cpp.
TorcWebSocket::~TorcWebSocket | ( | ) |
Definition at line 113 of file torcwebsocket.cpp.
|
protectedslot |
Definition at line 977 of file torcwebsocket.cpp.
|
slot |
Cancel a Remote Procedure Call.
Definition at line 572 of file torcwebsocket.cpp.
|
slot |
Definition at line 761 of file torcwebsocket.cpp.
|
protectedslot |
Definition at line 774 of file torcwebsocket.cpp.
|
signal |
|
signal |
|
signal |
|
signal |
|
slot |
Definition at line 404 of file torcwebsocket.cpp.
|
protectedslot |
Definition at line 959 of file torcwebsocket.cpp.
|
overrideprotected |
Definition at line 983 of file torcwebsocket.cpp.
|
static |
Return a list of supported WebSocket sub-protocols.
Definition at line 394 of file torcwebsocket.cpp.
|
slot |
Definition at line 508 of file torcwebsocket.cpp.
bool TorcWebSocket::IsSecure | ( | void | ) |
Definition at line 423 of file torcwebsocket.cpp.
|
slot |
Receives notifications when a property for a subscribed service has changed.
Definition at line 496 of file torcwebsocket.cpp.
|
protectedslot |
Process incoming data.
Data for any given frame may be received over a number of packets, hence the need to track the current read status.
Definition at line 668 of file torcwebsocket.cpp.
|
slot |
Initiate a Remote Procedure Call.
Definition at line 529 of file torcwebsocket.cpp.
|
slot |
Definition at line 416 of file torcwebsocket.cpp.
|
slot |
Initialise the websocket once its parent thread is ready.
Definition at line 429 of file torcwebsocket.cpp.
|
protectedslot |
A subscriber object has been deleted.
If subscribers exit without unsubscribing, the subscriber list will never be cleaned up. So listen for deletion signals and act if necessary.
Definition at line 745 of file torcwebsocket.cpp.
|
protectedslot |
Definition at line 968 of file torcwebsocket.cpp.