summaryrefslogtreecommitdiffstats
path: root/docs/3_Developer_Guides/6_AFB_Helper_Guide/3.7.6_Qt_AFB_Websocket_client.md
blob: 17b4d2b59deb9c9af1789dd3877131fceaeef44c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
---
edit_link: ''
title: Qt AFB Websocket client
origin_url: >-
  https://git.automotivelinux.org/src/libafb-helpers/plain/docs/qafbwebsocketclient.md?h=master
---

<!-- 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 -->

# A WebSocket client to an Application Framework Binder

## QAfbWebsocketClient(QObject* parent = nullptr)

Default constructor.

* `parent`: Parent object.

## QAbstractSocket::SocketError error()

Get and return the last error code.

## QString errorString()

Get and return the last error as a string.

## bool isValid()

Check if connection is ready or not.

Returns `true` if the connected is ready to read and write, `false` otherwise.

## void call(const QString& api, const QString& verb, const QJsonValue& arg = QJsonValue(), closure_t closure = nullptr)

Call an api's verb with an argument.

* `api`: Api to call.
* `verb`: Verb to call.
* `arg`: Argument to pass.
* `closure`: callback function to call at the verb reply

## void QAfbWebsocketClient::sendTextMessage(QString msg)

Send a text message over the websocket.

This is use for test only, you should not use this method because it sent text
**as-is**, so you have to follow the binder's protocol by your self.

* `msg`: Message to send.