17b4d2b59deb9c9af1789dd3877131fceaeef44c
[AGL/documentation.git] / docs / 3_Developer_Guides / 6_AFB_Helper_Guide / 3.7.6_Qt_AFB_Websocket_client.md
1 ---
2 edit_link: ''
3 title: Qt AFB Websocket client
4 origin_url: >-
5   https://git.automotivelinux.org/src/libafb-helpers/plain/docs/qafbwebsocketclient.md?h=master
6 ---
7
8 <!-- WARNING: This file is generated by fetch_docs.js using /home/boron/Documents/AGL/docs-webtemplate/site/_data/tocs/devguides/master/afb-helpers-function-references-afb-helpers-book.yml -->
9
10 # A WebSocket client to an Application Framework Binder
11
12 ## QAfbWebsocketClient(QObject* parent = nullptr)
13
14 Default constructor.
15
16 * `parent`: Parent object.
17
18 ## QAbstractSocket::SocketError error()
19
20 Get and return the last error code.
21
22 ## QString errorString()
23
24 Get and return the last error as a string.
25
26 ## bool isValid()
27
28 Check if connection is ready or not.
29
30 Returns `true` if the connected is ready to read and write, `false` otherwise.
31
32 ## void call(const QString& api, const QString& verb, const QJsonValue& arg = QJsonValue(), closure_t closure = nullptr)
33
34 Call an api's verb with an argument.
35
36 * `api`: Api to call.
37 * `verb`: Verb to call.
38 * `arg`: Argument to pass.
39 * `closure`: callback function to call at the verb reply
40
41 ## void QAfbWebsocketClient::sendTextMessage(QString msg)
42
43 Send a text message over the websocket.
44
45 This is use for test only, you should not use this method because it sent text
46 **as-is**, so you have to follow the binder's protocol by your self.
47
48 * `msg`: Message to send.