Interface IMessagingService
MessagingService allows users to send a message to other users.
Namespace: Unity.Services.Friends
Syntax
public interface IMessagingService
Methods
MessageAsync<T>(String, T)
Sends a message from current user to target user. In order to facilitate deserialization of sent message on the receiving client, the message must have an empty constructor. The message received. The maximum size of the message payload is 10 kilobytes.
Declaration
Task MessageAsync<T>(string targetUserId, T message)
where T : new()
Parameters
Type | Name | Description |
---|---|---|
String | targetUserId | UserId to target with message. Must be in a friendship with current user. |
T | message | The message to send, should be serializable/deserializable as json |
Returns
Type | Description |
---|---|
Task |
Type Parameters
Name | Description |
---|---|
T |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | Represents an error that occurs when the service has not been initialized. |