Search Results for

    Show / Hide Table of Contents

    Interface IWebSocketClient

    Namespace: KSharpPlus.Net.WebSocket
    Assembly: KSharpPlus.dll
    Syntax
    public interface IWebSocketClient

    Properties

    | Improve this Doc View Source

    DefaultHeaders

    Gets the collection of default headers to send when connecting to the remote endpoint.

    Declaration
    IReadOnlyDictionary<string, string> DefaultHeaders { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<String, String>
    | Improve this Doc View Source

    Proxy

    Gets the proxy settings for this client.

    Declaration
    IWebProxy Proxy { get; }
    Property Value
    Type Description
    IWebProxy

    Methods

    | Improve this Doc View Source

    AddDefaultHeader(String, String)

    Adds a header to the default header collection.

    Declaration
    bool AddDefaultHeader(string name, string value)
    Parameters
    Type Name Description
    String name

    Name of the header to add.

    String value

    Value of the header to add.

    Returns
    Type Description
    Boolean

    Whether the operation succeeded.

    | Improve this Doc View Source

    ConnectAsync(Uri)

    Connects to a specified remote WebSocket endpoint.

    Declaration
    Task ConnectAsync(Uri uri)
    Parameters
    Type Name Description
    Uri uri

    The URI of the WebSocket endpoint.

    Returns
    Type Description
    Task
    | Improve this Doc View Source

    DisconnectAsync(Int32, String)

    Disconnects the WebSocket connection.

    Declaration
    Task DisconnectAsync(int code = 1000, string message = "")
    Parameters
    Type Name Description
    Int32 code
    String message
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    RemoveDefaultHeader(String)

    Removes a header from the default header collection.

    Declaration
    bool RemoveDefaultHeader(string name)
    Parameters
    Type Name Description
    String name

    Name of the header to remove.

    Returns
    Type Description
    Boolean

    Whether the operation succeeded.

    | Improve this Doc View Source

    SendMessageAsync(String)

    Send a message to the WebSocket server.

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

    The message to send.

    Returns
    Type Description
    Task

    Events

    | Improve this Doc View Source

    Connected

    Triggered when the client connects successfully.

    Declaration
    event AsyncEventHandler<IWebSocketClient, SocketEventArgs> Connected
    Event Type
    Type Description
    AsyncEventHandler<IWebSocketClient, SocketEventArgs>
    | Improve this Doc View Source

    Disconnected

    Triggered when the client is disconnected.

    Declaration
    event AsyncEventHandler<IWebSocketClient, SocketCloseEventArgs> Disconnected
    Event Type
    Type Description
    AsyncEventHandler<IWebSocketClient, SocketCloseEventArgs>
    | Improve this Doc View Source

    ExceptionThrown

    Triggered when an error occurs in the client.

    Declaration
    event AsyncEventHandler<IWebSocketClient, SocketErrorEventArgs> ExceptionThrown
    Event Type
    Type Description
    AsyncEventHandler<IWebSocketClient, SocketErrorEventArgs>
    | Improve this Doc View Source

    MessageReceived

    Triggered when the client receives a message from the remote party.

    Declaration
    event AsyncEventHandler<IWebSocketClient, SocketMessageEventArgs> MessageReceived
    Event Type
    Type Description
    AsyncEventHandler<IWebSocketClient, SocketMessageEventArgs>
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2023 KSharpPlus Contributors