Available languages: [Python](https://databento.com/docs/api-live/client/live-threaded-resubscribe.python.md) · [C++](https://databento.com/docs/api-live/client/live-threaded-resubscribe.cpp.md) · [Rust](https://databento.com/docs/api-live/client/live-threaded-resubscribe.rust.md) · [Raw](https://databento.com/docs/api-live/client/live-threaded-resubscribe.raw.md)

Source: https://databento.com/docs/api-live/client/live-threaded-resubscribe


### LiveThreaded::Resubscribe

Resubscribes only to active subscriptions, removing the original `start` time, if any.
Stored subscriptions and [unsubscriptions](https://databento.com/docs/api-live/client/live-threaded-unsubscribe.md) are replayed in the order they were sent.
Usually performed after calling [LiveThreaded.Reconnect](https://databento.com/docs/api-live/client/live-threaded-reconnect.md).

#### API method

```cpp
void Resubscribe();
```

#### Example usage

```cpp
#include <databento/exceptions.hpp>
#include <databento/live.hpp>
#include <exception>

using namespace databento;

auto client = LiveThreaded::Builder()
                  .SetKey("$YOUR_API_KEY")
                  .SetDataset("GLBX.MDP3")
                  .BuildThreaded();
client.Subscribe({"CL.c.0"}, Schema::Trades, SType::Continuous);
auto record_callback = [](const databento::Record&) {
  return KeepGoing::Continue;
};
auto exc_callback = [&client](const std::exception& exc) {
  if (dynamic_cast<const TcpError*>(&exc)) {
    client.Resubscribe();
    return LiveThreaded::ExceptionAction::Restart;
  }
  return LiveThreaded::ExceptionAction::Stop;
};
// Ignore metadata
client.Start({}, record_callback, exc_callback);
```
