Chat / Unreal
Current version: v3
Chat Unreal v3
Chat Unreal
Chat
Unreal
Home
/
Chat
/
Unreal
/
Channels

Create a channel metacounter

You can store additional information to channels such as the tracking number of likes with channel metacounter, which can be fetched or rendered into the UI. A channel metacounter is a std::map<std::wstring, int64_t> and it can be stored into a channel object.

To store a channel metacounter into a channel object, add key-value items after creating a std::map<std::wstring, int64_t>, and pass it as an argument to a parameter when calling the CreateMetaCounters() method. You can put multiple key-value items in the map.

std::map<std::wstring, int64_t> metaCounters;
metaCounters[L"key1"] = 1;
metaCounters[L"key2"] = 2;

channel->CreateMetaCounters(metaCounters, [](const std::map<std::wstring, int64_t>& metaCounters, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }
});

Note : A channel metacounter is primarily used to track and update discrete indicators in a channel. Use channel metacounter instead of channel metadata when you need an integer with atomic increasing and decreasing operations.