/ SDKs / Unreal
SDKs
Chat SDKs Unreal v3
Chat SDKs Unreal
Chat SDKs
Unreal
Version 3

Search open channels by name, URL, or custom type

Copy link

You can search for specific open channels by adding keywords to an SBDOpenChannelListQuery instance. There are two types of keywords: a Name and a URL. The code sample below shows the query instance which returns a list of open channels that partially match the specified Name keyword in the names of the channels.

SBDOpenChannelListQuery* query = SBDOpenChannel::CreateOpenChannelListQuery();

query->SetChannelNameFilter(L"Sendbird");
query->LoadNextPage([](vector<SBDOpenChannel*> openChannels, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }

    // Through the openChannels parameter of the handler callback function, 
    // which the Sendbird server has passed a result list to,
    // a list of open channels that have 'Sendbird' in their names is returned.
});

The following shows the query instance which returns a list of open channels that partially match the specified URL keyword in the URLs of the channels.

SBDOpenChannelListQuery* query = SBDOpenChannel::CreateOpenChannelListQuery();

query->SetChannelUrlFilter(L"seminar");
query->LoadNextPage([](vector<SBDOpenChannel*> openChannels, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }

    // Through the openChannels parameter of the handler callback function, 
    // which the Sendbird server has passed a result list to,
    // a list of open channels that have 'seminar' in their URLs is returned.
});

Using the SetCustomTypeFilter() like the following, you can also search for open channels with a specific custom type.

SBDOpenChannelListQuery* query = SBDOpenChannel::CreateOpenChannelListQuery();

query->SetCustomTypeFilter(L"movie");
query->LoadNextPage([](vector<SBDOpenChannel*> openChannels, SBDError* error) {
    if (error != nullptr) {
        // Handle error.
        return;
    }

    // Through the openChannels parameter of the handler callback function,
    // which the Sendbird server has passed a result list to,
    // a list of open channels with a 'movie' custom type is returned.
});