Cloudy API Documentation
  • SETUP
    • Introduction
    • Setting Up Your Project
    • Update Log
    • Cloudy API Tutorial
    • Credits
  • FUNCTIONS
    • AutoInject
    • Inject
    • Execute
    • GetClientsList
    • RegisterExecutor
    • IsInjected
    • AutoSetup
    • disableSecurity
    • isRobloxOpen
    • CheckRobloxVersion
    • GetUsername
    • killRoblox
    • AskAi
    • Cleanres
    • SetDiscordRpc
    • IsAutoInjectEnabled
  • credits
  • GetUserIdFromUsername
  • GetAvatar
  • SetScriptJS
  • AddTabJS
  • GetDiscordUsername
  • cPlaceId
  • cPlaceName
  • cPlaceImage
  • CHAT FUNCTIONS
    • ConnectToServer
    • ReceiveMessages
    • SendMessage
    • Disconnect
    • OnMessageReceived
    • OnError
    • Messages
Powered by GitBook
On this page
  1. CHAT FUNCTIONS

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}");
}
PreviouscPlaceImageNextReceiveMessages

Last updated 1 month ago