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

Source: https://databento.com/docs/api-live/client/live-blocking-subscribe-with-snapshot


### LiveBlocking::SubscribeWithSnapshot

Add a new [snapshot](https://databento.com/docs/conventions/mbo-snapshot.md) subscription to the session.
This is only supported for the [MBO](https://databento.com/docs/schemas/mbo.md) schema.

Subscriptions end when the client disconnects in its destructor, by calling [LiveBlocking::Stop](https://databento.com/docs/api-live/client/live-blocking-stop.md), or when their symbols are removed with [LiveBlocking::Unsubscribe](https://databento.com/docs/api-live/client/live-blocking-unsubscribe.md).

#### API method

```cpp
void SubscribeWithSnapshot(
    const std::vector<std::string>& symbols, Schema schema,
    SType stype_in);
```

#### Parameters

| Parameter | Type | Description |
| `symbols` | std::vector\ | The product symbols to subscribe to. Takes up to 2,000 symbols per request. |
| `schema` | databento::Schema | The data record [schema](https://databento.com/docs/schemas/whats-a-schema.md). Only `Mbo` is supported. |
| `stype_in` | databento::SType | The [symbology type](https://databento.com/docs/api-live/basics/symbology.md) of input `symbols`. |

#### Example usage

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

using namespace databento;

auto client = LiveBlocking::Builder()
                  .SetKey("$YOUR_API_KEY")
                  .SetDataset("GLBX.MDP3")
                  .BuildBlocking();
client.SubscribeWithSnapshot({"ES.c.0"}, Schema::Mbo,
                             SType::Continuous);
```
