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

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


### LiveBlocking::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-blocking-unsubscribe.md) are replayed in the order they were sent.
Usually performed after calling [LiveBlocking.Reconnect](https://databento.com/docs/api-live/client/live-blocking-reconnect.md).

#### API method

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

#### Example usage

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

using namespace databento;

auto client = LiveBlocking::Builder()
                  .SetKey("$YOUR_API_KEY")
                  .SetDataset("GLBX.MDP3")
                  .BuildBlocking();
client.Subscribe({"BRN.FUT"}, Schema::Ohlcv1M, SType::Parent);
auto metadata = client.Start();
for (int32_t i = 0; i < 10; ++i) {
  try {
    [[maybe_unused]] auto record = client.NextRecord();
  } catch (const databento::TcpError& error) {
    std::cerr << "Caught TCP error: " << error.what()
              << "\nAttempting reconnect\n";
    client.Reconnect();
    client.Resubscribe();
    metadata = client.Start();
  } catch (const std::exception& exc) {
    std::cerr << "Caught unknown exception: " << exc.what()
              << "\nShutting down\n";
    client.Stop();
  }
}
```
