# Class ChatHub | EchoHub Documentation

# Class ChatHub

Namespace
  EchoHub.Server.Hubs

Assembly
  EchoHub.Server.dll

    [Authorize]
    public class ChatHub : Hub<IEchoHubClient>, IDisposable

Inheritance
  object
  Hub
  Hub<IEchoHubClient>
  ChatHub

Implements
  IDisposable

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

## Constructors

### ChatHub(IChatService, IChannelService, ILogger<ChatHub>)

    public ChatHub(IChatService chatService, IChannelService channelService, ILogger<ChatHub> logger)

#### Parameters

`chatService` IChatService
`channelService` IChannelService
`logger` ILogger<ChatHub>

## Methods

### GetChannelHistory(string, int, int)

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

#### Parameters

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

#### Returns

Task<List<MessageDto>>

### GetOnlineUsers(string)

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

#### Parameters

`channelName` string

#### Returns

Task<List<UserPresenceDto>>

### JoinChannel(string, string?)

    public Task<JoinChannelResult> JoinChannel(string channelName, string? password = null)

#### Parameters

`channelName` string
`password` string

#### Returns

Task<JoinChannelResult>

### LeaveChannel(string)

    public Task LeaveChannel(string channelName)

#### Parameters

`channelName` string

#### Returns

Task

### OnConnectedAsync()

    public override Task OnConnectedAsync()

#### Returns

Task

### OnDisconnectedAsync(Exception?)

    public override Task OnDisconnectedAsync(Exception? exception)

#### Parameters

`exception` Exception

#### Returns

Task

### SendMessage(string, string, Guid?)

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

#### Parameters

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

#### Returns

Task

### UpdateStatus(UserStatus, string?)

    public Task UpdateStatus(UserStatus status, string? statusMessage)

#### Parameters

`status` UserStatus
`statusMessage` string

#### Returns

Task