Search Results for

    Show / Hide Table of Contents

    Interface IWebSocket

    Inherited Members
    IDisposable.Dispose()
    Namespace: Glitch9.IO.Networking.WebSocket
    Assembly: Glitch9.IO.dll
    Syntax
    public interface IWebSocket : IDisposable

    Properties

    | Edit this page View Source

    OnStateChanged

    Event handler for when the WebSocket connection state changes.

    Declaration
    Action<WebSocketState> OnStateChanged { get; set; }
    Property Value
    Type Description
    Action<WebSocketState>
    | Edit this page View Source

    State

    The current state of the WebSocket connection.

    Declaration
    WebSocketState State { get; }
    Property Value
    Type Description
    WebSocketState
    | Edit this page View Source

    SubProtocol

    The WebSocket connection object.

    Declaration
    string SubProtocol { get; }
    Property Value
    Type Description
    string

    Methods

    | Edit this page View Source

    CloseAsync(WebSocketCloseStatus, string, CancellationToken)

    Close the WebSocket connection.

    Declaration
    UniTask CloseAsync(WebSocketCloseStatus closeStatus, string closeDescription, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    WebSocketCloseStatus closeStatus

    The status code indicating the reason for closing the connection.

    string closeDescription

    The reason for closing the connection.

    CancellationToken cancellationToken
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    ConnectAsync(Uri, CancellationToken, params HttpHeader[])

    Connect to the WebSocket server with a Uri endpoint URL.

    Declaration
    UniTask ConnectAsync(Uri uri, CancellationToken cancellationToken, params HttpHeader[] headers)
    Parameters
    Type Name Description
    Uri uri
    CancellationToken cancellationToken
    HttpHeader[] headers
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    ReceiveAsync(ArraySegment<byte>, CancellationToken)

    Receive a response from the WebSocket server.

    Declaration
    UniTask<WebSocketReceiveResult> ReceiveAsync(ArraySegment<byte> buffer, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    ArraySegment<byte> buffer
    CancellationToken cancellationToken
    Returns
    Type Description
    UniTask<WebSocketReceiveResult>
    | Edit this page View Source

    SendAsync(ArraySegment<byte>, WebSocketMessageType, bool, CancellationToken)

    Send a buffer to the WebSocket server. The buffer is binary data. This is WebSocket equivalent of multi-part/form-data.

    Declaration
    UniTask SendAsync(ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken token)
    Parameters
    Type Name Description
    ArraySegment<byte> buffer
    WebSocketMessageType messageType
    bool endOfMessage
    CancellationToken token
    Returns
    Type Description
    UniTask
    | Edit this page View Source

    SendAsync(string, CancellationToken)

    Send a message to the WebSocket server. The message is most likely a JSON string. This is WebSocket equivalent of application/json.

    Declaration
    UniTask SendAsync(string jsonString, CancellationToken token)
    Parameters
    Type Name Description
    string jsonString
    CancellationToken token
    Returns
    Type Description
    UniTask

    Extension Methods

    ArrayExtensions.ToArrayOrEmpty<T>(T)
    ArrayExtensions.ToArrayOrNull<T>(T)
    EventExtensions.ToDelta<T>(T, string, int, string, bool)
    EventExtensions.ToDone<T>(T, string, int, string)
    EventExtensions.ToEvent<T>(T)
    EventExtensions.UpcastDelta<T1, T2>(T1, string, int, string, bool)
    FallbackExtensions.IsOr<TParent, TChild>(TParent, TChild)
    ResponseCastingExtensions.GetResult<T>(T)
    SystemExtensions.TryDispose(IDisposable)
    SystemExtensions.GetName(object)
    • Edit this page
    • View Source
    In this article
    Back to top AI DevKit Documentation