docs.unity3d.com
    Show / Hide Table of Contents

    Interface IWebSocketClient

    An interface for using a Messaging client and listen to events.

    Inherited Members
    IDisposable.Dispose()
    Namespace: Unity.Cloud.Common
    Syntax
    public interface IWebSocketClient : IDisposable

    Properties

    State

    Reference to the current state of the connection

    Declaration
    ConnectionState State { get; }
    Property Value
    Type Description
    ConnectionState

    Methods

    ConnectAsync(Uri, HttpHeaders)

    Attempts opening a connection to a server

    Declaration
    Task ConnectAsync(Uri uri, HttpHeaders headers = null)
    Parameters
    Type Name Description
    Uri uri

    The uri to connect to.

    HttpHeaders headers

    The HTTP headers for the connection request.

    Returns
    Type Description
    Task

    The connection task.

    DisconnectAsync()

    Closes a connection to a server

    Declaration
    Task DisconnectAsync()
    Returns
    Type Description
    Task

    The disconnection task.

    SendAsync(ArraySegment<Byte>)

    Method to send binary data to a server

    Declaration
    Task SendAsync(ArraySegment<byte> message)
    Parameters
    Type Name Description
    ArraySegment<Byte> message

    The message to send.

    Returns
    Type Description
    Task

    The send message task.

    SendAsync(String)

    Sends a message to a server.

    Declaration
    Task SendAsync(string message)
    Parameters
    Type Name Description
    String message

    The message to send.

    Returns
    Type Description
    Task

    The send message task.

    Events

    ConnectionErrorOccured

    Event invoked when a connection error occurs

    Declaration
    event Action<Exception> ConnectionErrorOccured
    Event Type
    Type Description
    Action<Exception>

    ConnectionStateChanged

    Event invoked when the state changes

    Declaration
    event Action<ConnectionState> ConnectionStateChanged
    Event Type
    Type Description
    Action<ConnectionState>

    DataReceived

    Event invoked when binary data is received from the server

    Declaration
    event Action<ArraySegment<byte>> DataReceived
    Event Type
    Type Description
    Action<ArraySegment<Byte>>

    MessageReceived

    Event invoked when a message is received from the server

    Declaration
    event Action<string> MessageReceived
    Event Type
    Type Description
    Action<String>
    Back to top
    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