Forward messages
The message forwarding feature lets you resend published messages or conversations to:
-
Share relevant information - you can forward messages or threads with additional relevant context to other users, ensuring efficient knowledge sharing.
-
Collaborate and consult - forwarding messages helps in decision-making by involving those who may have valuable insights and can contribute to ongoing discussions or projects.
You can let users send a given message from one channel to another with Forward()
and ForwardMessage()
.
All of them give the same output. The only difference is that you call a given method either directly on the message (Forward()
) or the channel or the chat (ForwardMessage()
) object. Depending on the object, these methods take different input parameters.
Additional info in the forwarded message
Each forwarded message contains additional metadata: originalPublisher
with the user ID of the person who originally published the message (to track its owner) and originalChannelId
with the ID of the channel where the message was originally published.
Method signature
- Blueprint
- C++ / Input parameters
-
Message->Forward()
Message.Forward(FString ChannelID);
-
Channel->ForwardMessage()
Channel->ForwardMessage(UPubnubMessage* Message);
-
Chat->ForwardMessage()
Chat->ForwardMessage(
UPubnubChannel* Channel,
UPubnubMessage* Message
);
Parameter | Type | Required in Message->Forward() | Required in Channel->ForwardMessage() | Required in Chat->ForwardMessage() | Default | Description |
---|---|---|---|---|---|---|
ChannelID | FString | Yes | No | No | n/a | Unique identifier of the channel to which you want to forward the message. You can forward a message to the same channel on which it was published or to any other. |
Channel | UPubnubChannel* | No | No | Yes | n/a | Channel object to which you want to forward the message. You can forward a message to the same channel on which it was published or to any other. |
Message | UPubnubMessage* | No | Yes | Yes | n/a | Message object that you want to forward to the selected channel. |
Output
These methods don't return any value.
Basic usage
Forward a message from the support
channel to the incident-management
channel.
-
Forward()
show all 17 lines
#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); -
ForwardMessage()
show all 17 lines#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");
UPubnubChannel* Channel2 = Chat->GetChannel("incident-management");
FString Timetoken = "16200000000000001";
// Fetch the message
UPubnubMessage* Message = Channel->GetMessage(Timetoken);