Class ConversationSystem
Defined in File ConversationSystem.h
Inheritance Relationships
Base Type
public csp::systems::SystemBase
(Class SystemBase)
Class Documentation
-
class ConversationSystem : public csp::systems::SystemBase
Public facing system that can handle conversations taking place between users of a space in the form of thread messages.
Asynchronous Calls
These are methods that perform WebClient calls and therefore operate asynchronously and require a callback to be passed for a completion result
-
void CreateConversation(const csp::common::String &Message, csp::systems::StringResultCallback Callback)
Creates a new conversation with the initial message and provides the conversation ID to the given callback.
- Parameters
Message – csp::common::String : The message to be stored.
Callback – StringResultCallback : Callback when asynchronous task finishes
-
void AddMessageToConversation(const csp::common::String &ConversationId, const csp::common::String &SenderDisplayName, const csp::common::String &Message, MessageResultCallback Callback)
Adds a message to a brand new conversation or to an already existing one.
Make sure that the user has entered a space through SpaceSystem::EnterSpace() before calling this. Sends a network event acknowledgement that can be listened for called “ConversationSystem” containing: {ConversationSystemParams of type ReplicatedType : ConversationMessageType::NewMessage, ConversationId of type ReplicatedType : String}.
- Parameters
ConversationId – csp::common::String : A new message will be linked to the provided conversation id.
SenderDisplayName – csp::common::String : The display name of the message sender.
Message – csp::common::String : The message to be stored.
Callback – MessageResultCallback : Callback when asynchronous task finishes.
-
void GetMessagesFromConversation(const csp::common::String &ConversationId, const csp::common::Optional<int> &ResultsSkipNumber, const csp::common::Optional<int> &ResultsMaxNumber, MessageCollectionResultCallback Callback)
Retrieves messages that are linked to the provided Conversation ID.
- Parameters
ConversationId – csp::common::String : Conversation ID.
ResultsSkipNumber – Optional<int> : Optional parameter representing the number of result entries that will be skipped from the result. For no skip pass nullptr.
ResultsMaxNumber – Optional<int> : Optional parameter representing the maximum number of result entries to be retrieved. For all available result entries pass nullptr.
Callback – MessageCollectionResultCallback : Callback when asynchronous task finishes.
-
void GetConversationInformation(const csp::common::String &ConversationId, ConversationResultCallback Callback)
Retrieves the conversation information.
- Parameters
ConversationId – csp::common::String : Conversation ID.
Callback – ConversationResultCallback : Callback when asynchronous task finishes.
-
void SetConversationInformation(const csp::common::String &ConversationId, const ConversationInfo &ConversationData, ConversationResultCallback Callback)
Sets the conversation information.
- Parameters
ConversationId – csp::common::String : Conversation ID.
ConversationData – ConversationInfo : Conversation Data.
Callback – ConversationResultCallback : Callback when asynchronous task finishes.
-
void GetMessage(const csp::common::String &MessageId, MessageResultCallback Callback)
Retrieves one particular message.
- Parameters
MessageId – csp::common::String : ID of the message to be retrieved.
Callback – MessageResultCallback : Callback when asynchronous task finishes.
-
void SetMessageInformation(const csp::common::String &MessageId, const MessageInfo &MessageData, MessageResultCallback Callback)
Sets the message information.
- Parameters
MessageId – csp::common::String : ID of the message to be retrieved.
MessageData – MessageInfo : Message Data.
Callback – MessageResultCallback : Callback when asynchronous task finishes.
-
void GetMessageInformation(const csp::common::String &MessageId, MessageResultCallback Callback)
Retrieves the message information.
- Parameters
MessageId – csp::common::String : Message ID.
Callback – MessageResultCallback : Callback when asynchronous task finishes.
-
void DeleteConversation(const csp::common::String &ConversationId, csp::systems::NullResultCallback Callback)
Deletes all the messages that are part of the conversation.
Sends a network event acknowledgement that can be listened for called “ConversationSystem” containing: {ConversationSystemParams of type ReplicatedType : ConversationMessageType::DeleteConversation, ConversationId of type ReplicatedType : String}.
- Parameters
ConversationId – csp::common::String : ID of the conversation that will be deleted. After this operation finishes successful this ID will not be valid anymore.
Callback – NullResultCallback : Callback when asynchronous task finishes.
-
void DeleteMessage(const csp::common::String &MessageId, csp::systems::NullResultCallback Callback)
Deletes a particular message.
Sends a network event acknowledgement that can be listened for called “ConversationSystem” containing: { ConversationSystemParams of type ReplicatedType : ConversationMessageType::DeleteMessage, MessageId of type ReplicatedType : String }.
- Parameters
MessageId – csp::common::String : ID of the message that will be deleted.
Callback – NullResultCallback : Callback when asynchronous task finishes.
Public Types
-
typedef std::function<void(const csp::multiplayer::ConversationSystemParams&)> ConversationSystemCallbackHandler
Public Functions
-
ConversationSystem(MultiplayerConnection *InMultiPlayerConnection)
Constructs a conversation system instance that uses the given multiplayer connection.
- Parameters
InMultiPlayerConnection – MultiplayerConnection : The connection to be used.
-
~ConversationSystem()
-
void SetConnection(csp::multiplayer::SignalRConnection *InConnection)
Sets a local pointer to the connection for communication with the endpoints, this should be called as early as possible.
Note that this is already called in MultiplayerConnection::Connect, so this shouldn’t need to be called anywhere else. This should not be called by client code directly, marked as No Export.
- Parameters
InConnection – csp::multiplayer::SignalRConnection : The connection to be used by the conversation system.
-
void SetConversationSystemCallback(ConversationSystemCallbackHandler Callback)
Sets a callback for a conversation new message event.
- Parameters
Callback – ConversationMessageCallbackHandler: Callback to receive ConversationSystem Data when a message is sent. Callback will have to reset the callback passed to the system to avoid “dangling objects” after use.
-
virtual void RegisterSystemCallback() override
Registers the system to listen for the named event.
-
virtual void DeregisterSystemCallback() override
Deregisters the system from listening for the named event.
-
virtual void OnEvent(const std::vector<signalr::value> &EventValues) override
Deserialises the event values of the system.
- Parameters
EventValues – std::vector<signalr::value> : event values to deserialise
-
void CreateConversation(const csp::common::String &Message, csp::systems::StringResultCallback Callback)