44 o[
"type"] =
"vfsclient";
59 p[
"command"] = command;
60 p[
"attributes"] = attributes;
62 QString c = QJsonDocument(p).toJson();
77 p[
"command"] = command;
78 p[
"attributes"] = attributes;
80 QByteArray c = QJsonDocument(p).toJson();
101 QJsonObject o = m.object();
102 QString command = o[
"command"].toString();
103 QJsonObject attrs = o[
"attributes"].toObject();
105 if (command ==
"error")
110 else if (command ==
"authorization")
112 if (attrs[
"accepted"].toBool())
124 VFS::ERROR( QString(
"%1 authorization was denied... use different credentials?").arg(
className()) );
128 else if (command ==
"ping" || command ==
"pong")
132 else if (command ==
"code")
QString className()
Return the class name of a node.
virtual QJsonDocument receive(QByteArray message)
Receive a message from the server.
QString _password
password used when authenticating
virtual ~VFS_websocket_VFSclient()
void authDenied()
A connection was attempted, but authorization was denied.
void sendText(QString command, QJsonObject attributes)
Send a VFS command as a text message.
void sendBinary(QString command, QJsonObject attributes)
Send a VFS command as a text message.
void commandReceived(QString command, QJsonObject attributes)
A command was received, but it needs to be processed by a listener.
QString _username
username used when authenticating
void authorized()
A connection has been made and authorization is complete.
virtual void socket_connected()
Override the default VFS_websocket_client::socket_connected() command to include an authorization ste...
VFS_websocket_VFSclient(QString wsurl, QString username, QString password="", quint16 interval=3000)
Create a websocket client that will observe VFS connection rules like auth and reconnect.
A VFS_node that manages a QWebSocket connection.
virtual void socket_connected()
Slot called when the client is connected.
int _connectID
For client connections, the reconnect timerID.
bool _authenticated
if auth has taken place and succeeded
virtual void close()
Close the socket if it is connected.
virtual bool writeBinary(QByteArray data)
Write binary data over the websocket.
virtual bool writeText(QString data)
Write text data over the websocket.
virtual QJsonDocument receive(QByteArray message)
VFS_websocket_VFSclient::receive.
static void ERROR(QString message, int level=0, QString user="server")
Send a message to the VFS::_errors VFS_stream.
static void WARN(QString message, int level=0, QString user="server")
Send a message to the VFS::_warnings VFS_stream.
message(m)
Change the message of an existing arrowMessage.