Search Results for

    Show / Hide Table of Contents

    Class WebSocketClient

    Inheritance
    Object
    WebSocketClient
    Implements
    IWebSocketClient
    IDisposable
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ReferenceEquals(Object, Object)
    Object.ToString()
    Namespace: KSharpPlus.Net.WebSocket
    Assembly: KSharpPlus.dll
    Syntax
    public class WebSocketClient : IWebSocketClient

    Properties

    | Improve this Doc View Source

    DefaultHeaders

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

    Proxy

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

    Methods

    | Improve this Doc View Source

    AddDefaultHeader(String, String)

    Declaration
    public bool AddDefaultHeader(string name, string value)
    Parameters
    Type Name Description
    String name
    String value
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    ConnectAsync(Uri)

    Declaration
    public async Task ConnectAsync(Uri uri)
    Parameters
    Type Name Description
    Uri uri
    Returns
    Type Description
    Task
    | Improve this Doc View Source

    CreateNew(IWebProxy)

    Creates a new instance of WebSocketClient.

    Declaration
    public static IWebSocketClient CreateNew(IWebProxy proxy)
    Parameters
    Type Name Description
    IWebProxy proxy

    Proxy to use for this client instance.

    Returns
    Type Description
    IWebSocketClient

    An instance of WebSocketClient.

    | Improve this Doc View Source

    DisconnectAsync(Int32, String)

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

    Dispose()

    Disposes of resources used by this WebSocket client instance.

    Declaration
    public void Dispose()
    | Improve this Doc View Source

    RemoveDefaultHeader(String)

    Declaration
    public bool RemoveDefaultHeader(string name)
    Parameters
    Type Name Description
    String name
    Returns
    Type Description
    Boolean
    | Improve this Doc View Source

    SendMessageAsync(String)

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

    Events

    | Improve this Doc View Source

    Connected

    Triggered when the client connects successfully.

    Declaration
    public 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
    public 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
    public 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
    public event AsyncEventHandler<IWebSocketClient, SocketMessageEventArgs> MessageReceived
    Event Type
    Type Description
    AsyncEventHandler<IWebSocketClient, SocketMessageEventArgs>

    Implements

    IWebSocketClient
    IDisposable
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2023 KSharpPlus Contributors