summary:Subscribe class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.
---
# Subscribe
[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups. [More...](#detailed-description)
## Classes
| | Name |
| -------------- | -------------- |
| class | **[mcx_cpp::Subscription](Classes/classmcx__cpp_1_1Subscription.md)** |
| class | **[mcx_cpp::Subscribe](Classes/classmcx__cpp_1_1Subscribe.md)** |
| StatusReply | **[unsubscribe](Modules/group__subscribe.md#function-unsubscribe)**(const Subscription & subscription) const <br>Unsubscribes from the group. |
| SubscriptionReply | **[subscribe](Modules/group__subscribe.md#function-subscribe)**(std::vector<std::string> path_list, const std::string & group_alias, size_t frequency_divider) const <br>Create a subscription group for a list of the parameters. |
| void | **[close](Modules/group__subscribe.md#function-close)**() <br>Closes connection to the server. |
[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.
[Subscription](Classes/classmcx__cpp_1_1Subscription.md) class represents a group of parameters. It returns the latest values and a timestamp of the group. [Subscription](Classes/classmcx__cpp_1_1Subscription.md) class could be used as an observer, which notifies on every update or could be used as polling.
**Return**: a promise, which resolves when the unsubscribe operation is complete, fails otherwise.
### function subscribe
```cpp
SubscriptionReplysubscribe(
std::vector<std::string>path_list,
conststd::string&group_alias,
size_tfrequency_divider
)const
```
Create a subscription group for a list of the parameters.
**Return**: a subscription handle, which acts as a Promise, it is resolved when subscription is ready or failed. After the subscription is ready the handle is used to retrieve latest data.
### function close
```cpp
voidclose()
```
Closes connection to the server.
### function connect
```cpp
ConnectionReplyconnect(
std::stringurl,
constConnectionOptions&connection_options
)
```
Opens a subscribe connection.
**Return**: status of the connection.
### function connect
```cpp
ConnectionReplyconnect(
std::stringurl
)
```
Opens a subscribe connection.
**Return**: status of the connection.
### function url
```cpp
std::stringurl()const
```
Returns connection URL.
### function ~Subscribe
```cpp
~Subscribe()
```
Destructor.
### function Subscribe
```cpp
explicitSubscribe(
constRequest&request
)
```
Creates new [Subscribe](Classes/classmcx__cpp_1_1Subscribe.md).
### function Subscribe
```cpp
Subscribe()
```
---
# Modules
***module [Request](Modules/group__request.md)**<br>Request/Reply communication is used to send commands to a motorcortex server.
***module [Subscribe](Modules/group__subscribe.md)**<br>[Subscribe](Classes/classmcx__cpp_1_1Subscribe.md) class is used to receive continuous parameter updates from motorcortex server. It simplifies creating and removing subscription groups.