Report typing status
Report the current user’s typing status with the WASM SDK.
Pass focus: true when the user starts typing. Pass false after sending a message, when the input loses focus, when switching conversations, or when the user stops typing. Typing status is associated with conversationID; it neither saves a draft nor writes to the message list.
await openimsdk.changeInputStates({ conversationID, focus: true });
// When the user stops typing:
await openimsdk.changeInputStates({ conversationID, focus: false });Throttle the start-typing report and deduplicate state changes instead of reporting on every keyboard event. Promise completion means only that the server accepted the request; it does not mean a remote interface has already updated.
The complete listener for SdkEvent.OnConversationUserInputStatusChanged is provided on this page. Use a stable handler reference. When an event arrives, find the member by conversationID:userID and update their typing state with the event's platformIDs:
import { SdkEvent } from '@openim/wasm-client-sdk';
const handleInputStatusChanged = ({ data }) => {
updateTypingState(data.conversationID, data.userID, data.platformIDs);
};
openimsdk.on(SdkEvent.OnConversationUserInputStatusChanged, handleInputStatusChanged);
function removeInputStatusListener() {
openimsdk.off(SdkEvent.OnConversationUserInputStatusChanged, handleInputStatusChanged);
}Was this page helpful?