Skip to content

Commit

Permalink
Document missing getters about offline queue and reconnection options (
Browse files Browse the repository at this point in the history
…#255)

## What does this PR do?

Document missing getters in the C++ Kuzzle class about offline queue and reconnection options.

Depends on kuzzleio/sdk-cpp#71
  • Loading branch information
jenow authored and scottinet committed Mar 21, 2019
1 parent cd148fb commit 755049c
Show file tree
Hide file tree
Showing 21 changed files with 5,705 additions and 4,703 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test/templates/*.tpl.js
2 changes: 1 addition & 1 deletion docker/js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ ENV PATH $PATH:/nodejs/bin


RUN npm i -g eslint eslint-plugin-import@latest eslint-plugin-node@latest eslint-plugin-promise@latest eslint-plugin-standard@latest
RUN npm i -g puppeteer mqtt --unsafe-perm=true
RUN npm i -g puppeteer mqtt [email protected] [email protected] [email protected] --unsafe-perm=true

WORKDIR /app

Expand Down
9,676 changes: 5,048 additions & 4,628 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/sdk-reference/android/3/kuzzle/constructor/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ This is the main entry point to communicate with Kuzzle. Every other object inhe
| ``queueMaxSize`` | integer | Number of maximum requests kept during offline mode | ``500`` |
| ``replayInterval`` | integer | Delay between each replayed requests, in milliseconds | ``10`` |
| ``reconnectionDelay`` | integer | number of milliseconds between reconnection attempts | ``1000`` |
| ``sslConnection`` | boolean | Switch Kuzzle connection to SSL mode | ``false`` |
| ``ssl`` | boolean | Switch Kuzzle connection to SSL mode | ``false`` |

**Notes:**

Expand Down Expand Up @@ -72,7 +72,7 @@ This is the main entry point to communicate with Kuzzle. Every other object inhe
| ``queueTTL`` | integer | Time a queued request is kept during offline mode, in milliseconds | Yes |
| ``replayInterval`` | integer | Delay between each replayed requests | Yes |
| ``reconnectionDelay`` | integer | Number of milliseconds between reconnection attempts | No |
| ``sslConnection`` | boolean | Connect to Kuzzle using SSL | No |
| ``ssl`` | boolean | Connect to Kuzzle using SSL | No |
| ``volatile`` | JSON object | Common volatile data, will be sent to all future requests | Yes |
**Notes:**

Expand Down
90 changes: 85 additions & 5 deletions src/sdk-reference/cpp/1/kuzzle/getters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,46 @@ order: 100

# Kuzzle class getters

## autoQueue

Returns a boolean telling if queries are automatically queued during offline mode.

### Arguments

```cpp
bool autoQueue() const noexcept;
```

## autoReconnect

Returns a boolean telling if it will automatically reconnect after a connection loss.

### Arguments

```cpp
bool autoReconnect() const noexcept;
```

## autoReplay

Returns a boolean telling if it automatically replays queued requests on a `reconnected` event.

### Arguments

```cpp
bool autoReplay() const noexcept;
```

## autoResubscribe

Returns a boolean telling if it automatically renews all subscriptions on a `reconnected` event.

### Arguments

```cpp
bool autoResubscribe() const noexcept;
```

## getProtocol

Returns the protocol instance used internally to communicate with the Kuzzle server.
Expand All @@ -17,24 +57,64 @@ Returns the protocol instance used internally to communicate with the Kuzzle ser
Protocol* getProtocol();
```

## getJwt
## jwt

Returns the JWT currently used to authenticate requests.

### Arguments

```cpp
const std::string jwt() const noexcept;
```

## queueMaxSize

Returns the number of maximum requests kept during offline mode.

### Arguments

```cpp
int queueMaxSize() const noexcept;
```

## queueTTL

Returns the time a queued request is kept during offline mode, in milliseconds.

### Arguments

```cpp
int queueTTL() const noexcept;
```

## replayInterval

Returns the delay between each replayed requests.

### Arguments

```cpp
int replayInterval() const noexcept;
```

## reconnectionDelay

Returns the JWT token currently used to authenticate requests.
Returns the time between each reconnection attempt, in milliseconds.

### Arguments

```cpp
std::string getJwt();
int reconnectionDelay() const noexcept;
```

## getVolatile
## volatiles

Returns the JSON string representing volatile data sent with each request.

### Arguments

```cpp
std::string getVolatile();
const std::string& volatiles() const noexcept;
```

## Usage
Expand Down
20 changes: 18 additions & 2 deletions src/sdk-reference/cpp/1/kuzzle/getters/snippets/getters.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,24 @@
kuzzleio::Kuzzle *kuzzle = new kuzzleio::Kuzzle(
new kuzzleio::WebSocket("kuzzle"));

std::string jwt_token = kuzzle->jwt();

kuzzleio::Protocol *protocol = kuzzle->getProtocol();

std::string jwt_token = kuzzle->getJwt();
int max_size = kuzzle->queueMaxSize();

int queue_ttl = kuzzle->queueTTL();

int replay_interval = kuzzle->replayInterval();

int reconnection_delay = kuzzle->reconnectionDelay();

std::string volatile_data = kuzzle->volatiles();

bool auto_queue = kuzzle->autoQueue();

bool auto_reconnect = kuzzle->autoReconnect();

bool auto_replay = kuzzle->autoReplay();

std::string volatile_data = kuzzle->getVolatile();
bool auto_resubscribe = kuzzle->autoResubscribe();
8 changes: 4 additions & 4 deletions src/sdk-reference/cpp/1/kuzzle/setters/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,25 @@ order: 200

# Kuzzle class setters

## setAutoReplay
## autoReplay

Set the value for the auto-replay flag which allow to play queued request after a successfull auto-reconnection.

### Signature

```cpp
Kuzzle* setAutoReplay(bool);
Kuzzle* autoReplay(bool);
```
## setVolatile
## volatiles
Set the value of the global [volatile data]({{ site_base_path }}sdk-reference/cpp/1/kuzzle/introduction#volatile-data-default).
Value must be a JSON string representing a JSON object. (eg: `{"username": "Aschen"}`)
### Signature
```cpp
Kuzzle* setVolatile(const std::string&);
Kuzzle* volatiles(const std::string&);
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions src/sdk-reference/cpp/1/kuzzle/setters/snippets/setters.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
kuzzleio::Kuzzle *kuzzle = new kuzzleio::Kuzzle(
new kuzzleio::WebSocket("kuzzle"));

kuzzle->setAutoReplay(true);
kuzzle->autoReplay(true);

kuzzle->setVolatile(R"({ username: "Aschen" })");
kuzzle->volatiles(R"({ username: "Aschen" })");
Loading

0 comments on commit 755049c

Please sign in to comment.