Receive custom business messages
Use setCustomBusinessListener to receive business callbacks that are separate from regular chat messages.
Listen for custom business messages dispatched independently of regular conversation chat streams. Data received by this listener arrives as a raw string or JSON payload, making it ideal for call signaling, transparent command dispatches, and custom business workflows that should not render as chat bubbles in the conversation message list.
Code example
OpenIMClient.getInstance().messageManager.setCustomBusinessListener(
new OnCustomBusinessListener() {
@Override
public void onRecvCustomBusinessMessage(String payload) {
// payload contains the custom business JSON string or command data
}
}
);Callback parameters
payload(String): Raw custom business data string. The application should deserialize this string according to its negotiated JSON schema and dispatch to the appropriate business module.
Usage guidelines
Register this listener once within a centralized signaling service after SDK initialization. Custom business messages do not alter conversation unread counts or update the latest message preview in the conversation list. To construct and send custom business messages within conversations, see Create a custom message.
Was this page helpful?