v1.0.0
Latest
2020.3+
Interface IMessagingService
IMessagingService 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 the current user to the target user. To ease deserialization of sent message on the receiving client, the message must have an empty constructor. 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 | The ID of the user to target with the message. Must be friends with the current user. |
T | message | The message to send. It must be serializable (and 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. |
ArgumentException | Represents an error that occur when an argument is incorrectly set up. |
FriendsServiceException | An exception containing the HttpClientResponse with headers, response code, and string of error. |