# Class EchoHubConnection | EchoHub Documentation

# Class EchoHubConnection

Namespace
  EchoHub.Client.Services

Assembly
  EchoHub.Client.dll

    public sealed class EchoHubConnection : IAsyncDisposable

Inheritance
  object
  EchoHubConnection

Implements
  IAsyncDisposable

Inherited Members
  object.GetType()
  object.ToString()
  object.Equals(object)
  object.Equals(object, object)
  object.ReferenceEquals(object, object)
  object.GetHashCode()

## Constructors

### EchoHubConnection(string, ApiClient, ClientEncryptionService, RoomKeyStore)

    public EchoHubConnection(string serverUrl, ApiClient apiClient, ClientEncryptionService encryption, RoomKeyStore roomKeys)

#### Parameters

`serverUrl` string
`apiClient` ApiClient
`encryption` ClientEncryptionService
`roomKeys` RoomKeyStore

## Fields

### LockedMessagePlaceholder

    public const string LockedMessagePlaceholder = "[encrypted — rejoin this channel with its passphrase to unlock]"

#### Field Value

string

## Properties

### IsConnected

    public bool IsConnected { get; }

#### Property Value

bool

## Methods

### ConnectAsync()

    public Task ConnectAsync()

#### Returns

Task

### DisconnectAsync()

    public Task DisconnectAsync()

#### Returns

Task

### DisposeAsync()

    public ValueTask DisposeAsync()

#### Returns

ValueTask

### GetHistoryAsync(string, int, int)

    public Task<List<MessageDto>> GetHistoryAsync(string channelName, int count = 100, int offset = 0)

#### Parameters

`channelName` string
`count` int
`offset` int

#### Returns

Task<List<MessageDto>>

### GetOnlineUsersAsync(string)

    public Task<List<UserPresenceDto>> GetOnlineUsersAsync(string channelName)

#### Parameters

`channelName` string

#### Returns

Task<List<UserPresenceDto>>

### JoinChannelAsync(string, string?)

    public Task<JoinOutcome> JoinChannelAsync(string channelName, string? password = null)

#### Parameters

`channelName` string
`password` string

#### Returns

Task<JoinOutcome>

### LeaveChannelAsync(string)

    public Task LeaveChannelAsync(string channelName)

#### Parameters

`channelName` string

#### Returns

Task

### SendMessageAsync(string, string, Guid?)

    public Task SendMessageAsync(string channelName, string content, Guid? replyToMessageId = null)

#### Parameters

`channelName` string
`content` string
`replyToMessageId` Guid?

#### Returns

Task

### UpdateStatusAsync(UserStatus, string?)

    public Task UpdateStatusAsync(UserStatus status, string? statusMessage = null)

#### Parameters

`status` UserStatus
`statusMessage` string

#### Returns

Task

## Events

### OnChannelDeleted

    public event Action<string>? OnChannelDeleted

#### Event Type

Action<string>

### OnChannelNuked

    public event Action<string>? OnChannelNuked

#### Event Type

Action<string>

### OnChannelUpdated

    public event Action<ChannelDto>? OnChannelUpdated

#### Event Type

Action<ChannelDto>

### OnConnectionStateChanged

    public event Action<string>? OnConnectionStateChanged

#### Event Type

Action<string>

### OnError

    public event Action<string>? OnError

#### Event Type

Action<string>

### OnForceDisconnect

    public event Action<string>? OnForceDisconnect

#### Event Type

Action<string>

### OnMessageDeleted

    public event Action<string, Guid>? OnMessageDeleted

#### Event Type

Action<string, Guid>

### OnMessageReceived

    public event Action<MessageDto>? OnMessageReceived

#### Event Type

Action<MessageDto>

### OnReconnected

    public event Action? OnReconnected

#### Event Type

Action

### OnUserBanned

    public event Action<string, string?>? OnUserBanned

#### Event Type

Action<string, string>

### OnUserJoined

    public event Action<string, string, UserPresenceDto?>? OnUserJoined

#### Event Type

Action<string, string, UserPresenceDto>

### OnUserKicked

    public event Action<string, string, string?>? OnUserKicked

#### Event Type

Action<string, string, string>

### OnUserLeft

    public event Action<string, string>? OnUserLeft

#### Event Type

Action<string, string>

### OnUserStatusChanged

    public event Action<UserPresenceDto>? OnUserStatusChanged

#### Event Type

Action<UserPresenceDto>