docs.unity3d.com
    Show / Hide Table of Contents

    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.

    Back to top
    Terms of use
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023