Interface: MqttStorage

MqttStorage

Interface to be implemented for providing a custom storage layer to an MqttClient instance that connects requiring the management of session persistence.
See:

Method Summary

get
Retrieves from this storage the string value associated with the given key.
keys
Returns an array of all the keys contained in this storage.
remove
Removes the given key from this storage.
set
Adds or updates the given key to this storage, with the associated string value.

Method Detail

get(key) → {string}

Retrieves from this storage the string value associated with the given key.
Parameters:
Name Type Description
key string The key of the value to retrieve.
Returns:
The value associated with the given key.
Type
string

keys() → {Array.<string>}

Returns an array of all the keys contained in this storage.
Returns:
An array containing all the keys.
Type
Array.<string>

remove(key)

Removes the given key from this storage.
Parameters:
Name Type Description
key string The key to remove.

set(key, value)

Adds or updates the given key to this storage, with the associated string value.
Parameters:
Name Type Description
key string The key to add or update.
value string The value associated with the key.
Throws:
If any issue arises while adding or updating the key (e.g. the storage is full).
Type
Error