Links

Unity Chat SDK lets you encode URLs that begin with www, http, or https (plain links) so that they can be rendered as links.

You can attach links to the message and publish it using the SendText() method.

Method signature

Head over to the SendText() method for details.

Basic usage

Include these links in a text message: https://www.linkedin.com/mkelly_vp2 and https://admin.pubnub.com/#/login.

testChannel.Join();
testChannel.SendText("Message with https://www.linkedin.com/mkelly_vp2 and https://admin.pubnub.com/#/login", new SendTextParams()
{
TextLinks =
[
new TextLink()
{
StartIndex = 14,
EndIndex = 47,
Link = "https://www.linkedin.com/mkelly_vp2"
},
new TextLink()
{
StartIndex = 53,
EndIndex = 84,
show all 19 lines

You can access the TextLinks property of the Message object to return all text links in a given message.

Method signature

This is how you can access the property:

message.TextLinks

Properties

PropertyTypeDescription
TextLinksList<TextLink>List of all links included in a message.

Basic usage

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

// reference the "support" channel
if (chat.TryGetChannel("support", out var channel))
{
// get the message with the specific timetoken
if (channel.TryGetMessage("16200000000000000", out var message))
{
// check if the message contains any text links
if (message.TextLinks != null && message.TextLinks.Count > 0)
{
Console.WriteLine("The message contains the following text links:");
foreach (var textLink in message.TextLinks)
{
Console.WriteLine($"Text Link: {textLink.Link}");
}
}
show all 29 lines
Last updated on