Table of Contents

Class WebSocketClient

Namespace
DSharpPlus.Net.WebSocket
Assembly
DSharpPlus.dll

The default, native-based WebSocket client implementation.

public class WebSocketClient : IWebSocketClient
Inheritance
WebSocketClient
Implements

Constructors

WebSocketClient(IClientErrorHandler)

Instantiates a new WebSocket client.

Properties

DefaultHeaders

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

IsConnected

Gets the current state of the WebSocket connection.

Proxy

Gets the proxy settings for this client.

Methods

AddDefaultHeader(string, string)

Adds a header to the default header collection.

ConnectAsync(Uri)

Connects to a specified remote WebSocket endpoint.

DisconnectAsync(int, string)

Disconnects the WebSocket connection.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Dispose(bool)
RemoveDefaultHeader(string)

Removes a header from the default header collection.

SendMessageAsync(string)

Send a message to the WebSocket server.

Events

Connected

Triggered when the client connects successfully.

Disconnected

Triggered when the client is disconnected.

ExceptionThrown

Triggered when an error occurs in the client.

MessageReceived

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