ConnectToServer
This method connects the client to the WebSocket server using the URI specified in the serverUri variable.
This feature is deprecated and will be unsupported.
What it does: Attempts to connect to the WebSocket server. If successful, it starts receiving messages from the server asynchronously.
How to use it: Call this method to initiate the WebSocket connection.
Usage:
await ChatClient.ConnectToServer();
Example:
try
{
await ChatClient.ConnectToServer();
Console.WriteLine("Connected to server.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
Last updated