ChatView | Typing & Connection
Typing Indicators
Section titled “Typing Indicators”ChatView shows animated typing dots when a remote user is composing. Two halves: the control tells you when the current user is typing, and you tell the control when other users are typing.
Current user → provider
Section titled “Current user → provider”As the user types, the control debounces and calls:
Task ToggleTypingAsync(bool isTyping, CancellationToken ct = default);It sends true when typing begins and false on send or after an inactivity timeout. Broadcast this to other participants over your transport. (In a purely local provider there’s nothing to broadcast.)
public Task ToggleTypingAsync(bool isTyping, CancellationToken ct = default){ // forward to your hub/transport so the other participants see the indicator return this.hub.SendTypingAsync(this.SessionId, this.CurrentUserId, isTyping, ct);}Other users → control
Section titled “Other users → control”When a remote participant’s typing state changes, raise UserTyping:
public record UserTypingEvent(string UserId, bool IsTyping, DateTimeOffset Timestamp);this.UserTyping?.Invoke(this, new UserTypingEvent(remoteUserId, isTyping: true, DateTimeOffset.Now));The control handles the rest:
- Debounce of the outbound
ToggleTypingAsync. - Expiry of stale inbound indicators (if a
falsenever arrives, the dots time out on their own). - Rendering the
"{Name} is typing…"pill / animated dots, scroll-aware.
| Property | Type | Default | Description |
|---|---|---|---|
ShowTypingIndicator | bool | true | Enable/disable typing indicators entirely |
Connection State
Section titled “Connection State”Raise ConnectionStateChanged whenever your transport’s connectivity changes:
public enum ChatConnectionState { Connected, Reconnecting, Offline }this.ConnectionStateChanged?.Invoke(this, ChatConnectionState.Reconnecting);// ...later...this.ConnectionStateChanged?.Invoke(this, ChatConnectionState.Connected);The control reacts automatically:
| State | UI |
|---|---|
Connected | no banner; input bar enabled (subject to CanSendMessages) |
Reconnecting | banner shown; input bar disabled |
Offline | banner shown; input bar disabled |
There is no offline queue — sends are only attempted while Connected. A send that still fails transiently becomes MessageStatus.Failed (with retry); a provider rejection becomes MessageStatus.Rejected (no retry). See Messages & Paging.
Next Steps
Section titled “Next Steps”- The Provider Interface — where these events fit in the lifecycle
- Messages & Paging — optimistic send and retry behavior
- Reactions & Read Receipts — the other live presence signals