Appearance
Class: ChatActivity
Represents the channel's chat activity level: how lively the chat is right now, computed by the platform from the recent message rate relative to the channel's own baseline.
Remarks
You never instantiate this yourself: the SDK hands it to the callback of `k.chat.onActivityChange`, and it is also readable synchronously at any time via k.chat.activity. The activity level is relative to the channel: rate and baseline are messages per unit of time, ratio is rate / baseline, and state is the bucket that ratio falls into (silent → hot).
Example
ts
k.chat.onActivityChange((activity) => {
if (activity.isHot()) {
k.overlay.notification('Chat is on fire! 🔥');
}
});Properties
baseline
ts
baseline: number;The channel's own baseline message rate, used to compute ratio.
previous
ts
previous: ChatActivityState;Activity bucket just before this change.
rate
ts
rate: number;Current message rate (messages per unit of time).
ratio
ts
ratio: number;rate / baseline — how far above (or below) the usual pace the chat currently is.
state
ts
state: ChatActivityState;Current activity bucket.
ts
ts
ts: number;Timestamp (in milliseconds) at which this activity level was computed.
Methods
hasFallen()
ts
hasFallen(): boolean;Indicates whether the activity level fell compared to the previous state (e.g. hot → active).
Returns
boolean
true if state is quieter than previous.
See
hasRisen for the opposite direction.
hasRisen()
ts
hasRisen(): boolean;Indicates whether the activity level rose compared to the previous state (e.g. calm → active).
Returns
boolean
true if state is livelier than previous.
See
hasFallen for the opposite direction.
isActive()
ts
isActive(): boolean;Indicates whether the chat is currently active.
Returns
boolean
true if state is 'active'.
isHot()
ts
isHot(): boolean;Indicates whether the chat is currently hot (its busiest bucket).
Returns
boolean
true if state is 'hot'.
isSilent()
ts
isSilent(): boolean;Indicates whether the chat is currently silent (its quietest bucket).
Returns
boolean
true if state is 'silent'.