Links

Unreal Chat SDK lets you encode URLs that begin with www, http, or https (plain links) so that they can be customized and rendered as clickable links. You can also let chat users create hyperlinks manually by replacing URLs in messages with descriptive texts (text links).

icon

Usage in Blueprints and C++


Add linked text

Use the SendText() method with an additional TextLinks param to create a link within a message.

Method signature

Output

This method doesn't return any value.

Basic usage

Add a link to https://www.support-article.com/ to a message.

#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();

UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");

UPubnubChannel* Channel = Chat->GetChannel("support");

FSendTextParams SendTextParams;
FPubnubTextLink TextLink({14, 44, "https://www.support-article.com/"});
SendTextParams.TextLinks.Add(TextLink);
Channel->SendText("Support page:", SendTextParams);

TextLinks() is a getter method that returns all text links in a given message.

Method signature

Output

TypeDescription
TArray<FPubnubTextLink>Array of text links included in the message.

Basic usage

Get all text links included in the message with the 16200000000000000 timetoken.

#include "Kismet/GameplayStatics.h"
#include "PubnubChatSubsystem.h"

UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(this);
UPubnubChatSubsystem* PubnubChatSubsystem = GameInstance->GetSubsystem<UPubnubChatSubsystem>();

UPubnubChat* Chat = PubnubChatSubsystem ->InitChat("demo", "demo", "my_user");

UPubnubChannel* Channel = Chat->GetChannel("support");

FString Timetoken = "16200000000000001";

// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);

show all 16 lines
Last updated on