Send a custom signal
Exchange custom, transient signaling messages within an active calling room using signalingSendCustomSignal().
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
| Parameter | Type | Required | Description |
|---|---|---|---|
base | OnBase<String> | Yes | Callback delivering the asynchronous operation result. |
roomID | String | Yes | Target call room identifier. |
customInfo | String | Yes | Custom signal payload string, recommended to be structured JSON. |
Return value
Upon success, result in onSuccess returns a confirmation message.
State changes after the call
- Callback confirmation: The
onSuccesscallback indicates that the server accepted and routed the custom signal; it does not guarantee that the remote peer has processed it. - 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.
- Re-query calibration: Custom signals are transient and not replayed on reconnection. To reconcile room state after network recovery, re-query the room snapshot.
Was this page helpful?