Browse SDKs · Android
Platform
SDKsAndroid

Send a custom signal

Exchange custom, transient signaling messages within an active calling room using signalingSendCustomSignal().

Copy

Send lightweight, transient call-related messages within an active calling room, such as hand-raising notifications, layout switch prompts, or temporary status synchronization. This mechanism is designed for transient room coordination, not persistent chat messages or file transfers.

Code example

Both roomID and customInfo are required strings. When transmitting structured payloads, serialize them to JSON:

JSONObject signal = new JSONObject();
signal.put("version", 1);
signal.put("eventID", eventID);
signal.put("type", "hand-raised");
signal.put("userID", currentUserID);
signal.put("sentAt", System.currentTimeMillis());

OpenIMClient.getInstance().signalingManager.signalingSendCustomSignal(
    new OnBase<String>() {
        @Override
        public void onSuccess(String result) {
            // Custom signal dispatched successfully.
        }

        @Override
        public void onError(int code, String error) {
            // code and error describe the failure.
        }
    },
    roomID,
    signal.toString()
);

Parameters

ParameterTypeRequiredDescription
baseOnBase<String>YesCallback delivering the asynchronous operation result.
roomIDStringYesTarget call room identifier.
customInfoStringYesCustom signal payload string, recommended to be structured JSON.

Return value

Upon success, result in onSuccess returns a confirmation message.

State changes after the call

  1. Callback confirmation: The onSuccess callback indicates that the server accepted and routed the custom signal; it does not guarantee that the remote peer has processed it.
  2. Asynchronous event delivery: Room participants receive custom signals via OnSignalingListener.onReceiveCustomSignal:
@Override
public void onReceiveCustomSignal(CustomSignalingInfo info) {
    // Check info.getRoomID() before parsing info.getCustomInfo()
}

Include a protocol version and unique eventID in the payload so recipients can deduplicate incoming signals. Do not rely on delivery sequence to represent state machine transitions. Register this callback within your centralized listener in Handle call events.

  1. Re-query calibration: Custom signals are transient and not replayed on reconnection. To reconcile room state after network recovery, re-query the room snapshot.