Class WebSocketClient
Inheritance
Namespace: Xrpl.Client
Assembly: Xrpl.dll
Syntax
public class WebSocketClient
Constructors
| Edit this page View SourceWebSocketClient(string)
Declaration
protected WebSocketClient(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri |
Fields
| Edit this page View SourceIsDisposed
Declaration
public bool IsDisposed
Field Value
| Type | Description |
|---|---|
| bool |
Properties
| Edit this page View SourceFailureReason
Declaration
public SocketFailureReason FailureReason { get; }
Property Value
| Type | Description |
|---|---|
| SocketFailureReason |
State
Get the current state of the WebSocket client.
Declaration
public WebSocketState State { get; }
Property Value
| Type | Description |
|---|---|
| WebSocketState |
Methods
| Edit this page View SourceCancel()
Cancel work without setting intentional disconnect flag. Use CancelIntentionally() for user-initiated cancellations.
Declaration
public void Cancel()
CancelIntentionally()
Cancel work as an intentional disconnect. Sets the intentional disconnect flag before cancelling. Use this for user-initiated disconnects.
Declaration
public void CancelIntentionally()
Connect()
Connects to the WebSocket server.
Declaration
public Task<WebSocketClient> Connect()
Returns
| Type | Description |
|---|---|
| Task<WebSocketClient> | Self |
Create(string)
Creates a new instance.
Declaration
public static WebSocketClient Create(string uri)
Parameters
| Type | Name | Description |
|---|---|---|
| string | uri | The URI of the WebSocket server. |
Returns
| Type | Description |
|---|---|
| WebSocketClient | Instance of the created WebSocketWrapper |
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
ResetIntentionalDisconnect()
Resets the intentional disconnect flag to false. Called after successful connection to enable error detection.
Declaration
public void ResetIntentionalDisconnect()
SendMessage(string)
Send a UTF8 string to the WebSocket server.
Declaration
public void SendMessage(string message)
Parameters
| Type | Name | Description |
|---|---|---|
| string | message | The message to send |
SetIntentionalDisconnect()
Sets the intentional disconnect flag to true without cancelling. Use this before Cancel() if you need to set the flag earlier.
Declaration
public void SetIntentionalDisconnect()