SDKsiOS
Report typing status
Report the current user’s typing status with OpenIM iOS SDK.
When the user begins typing text in the input bar or ceases input, invoke changeInputStates:focus:onSuccess:onFailure: on OIMManager to synchronize the typing indicator with remote members in the conversation:
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
conversationID | NSString * | Yes | Target conversation identifier. |
focus | BOOL | Yes | Input focus flag. Pass YES when input commences; pass NO when the message is sent, focus is lost, the conversation switches, or typing halts. |
onSuccess | OIMSuccessCallback | Yes | Success callback confirming the server accepted the typing status request. |
onFailure | OIMFailureCallback | Yes | Failure callback returning error code code and descriptive message msg. |
Code example
[[OIMManager manager] changeInputStates:conversationID
focus:YES
onSuccess:^(NSString * _Nullable data) {
// Typing indicator reported successfully
}
onFailure:^(NSInteger code, NSString * _Nullable msg) {
// Handle reporting failure
}];Return value
The onSuccess callback confirms that the server accepted the input state change. The response data does not return a persistent record.
State changes after the call
- Ephemeral nature: Typing status is a transient state scoped to
conversationID. It is not stored in the database, does not create drafts, and is not recorded in conversation history. Debounce or throttle start-typing invocations to avoid excessive network overhead. - Receiving typing updates: Counterparties receive typing updates through
onConversationUserInputStatusChanged:inOIMConversationListener, which tracks active input platform IDs keyed by composite identityconversationID:userID. For complete conversation listener setup and teardown, see Retrieve conversation list. To actively poll input states, see Retrieve typing status.
Was this page helpful?