Skip to main content

Interface: TypingIndicatorConfig

Gala Launchpad SDK 9.0.0-rc.5


Gala Launchpad SDK 9.0.0-rc.5 / index / TypingIndicatorConfig

Interface: TypingIndicatorConfig

Defined in: packages/launchpad-sdk/dist/utils/websocket-patterns.d.ts:639

Typing Indicator Debouncer

Debounces typing indicator events to reduce message volume. Multiple typing events from the same user within the debounce window are collapsed into a single indicator.

Features:

  • Per-user debouncing (independent timers for each user)
  • Automatic cleanup of pending indicators
  • Configurable debounce delay
  • Prevents spam of typing events

Example​

// Test case: Typing indicator debouncing
const debouncer = new TypingIndicatorDebouncer({
delayMs: 100,
onTyping: (userId, roomId) => {
console.log(`User ${userId} is typing in ${roomId}`);
},
onStopTyping: (userId, roomId) => {
console.log(`User ${userId} stopped typing in ${roomId}`);
}
});

const events: string[] = [];
debouncer.onTyping = (userId, roomId) => {
events.push(`typing:${userId}:${roomId}`);
};
debouncer.onStopTyping = (userId, roomId) => {
events.push(`stop:${userId}:${roomId}`);
};

// Rapid typing events from same user
debouncer.indicate('user123', 'room1');
debouncer.indicate('user123', 'room1');
debouncer.indicate('user123', 'room1');

// Only one typing event sent (debounced)
console.assert(events.filter(e => e.startsWith('typing')).length === 1);

// Different users send independent indicators
debouncer.indicate('user456', 'room1');
debouncer.indicate('user789', 'room1');
console.assert(events.filter(e => e.startsWith('typing')).length === 3);

Since​

6.6.0

Properties​

delayMs?​

optional delayMs?: number

Defined in: packages/launchpad-sdk/dist/utils/websocket-patterns.d.ts:640


onStopTyping?​

optional onStopTyping?: (userId, roomId) => void | Promise<void>

Defined in: packages/launchpad-sdk/dist/utils/websocket-patterns.d.ts:642

Parameters​

userId​

string

roomId​

string

Returns​

void | Promise<void>


onTyping?​

optional onTyping?: (userId, roomId) => void | Promise<void>

Defined in: packages/launchpad-sdk/dist/utils/websocket-patterns.d.ts:641

Parameters​

userId​

string

roomId​

string

Returns​

void | Promise<void>