docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Interface IMessagingService

    IMessagingService allows users to send a message to other users.

    Namespace: Unity.Services.Friends
    Assembly: Unity.Services.Friends.dll
    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.

    In This Article
    Back to top
    Copyright © 2024 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)