Send a custom signal
Broadcast application-defined RTC custom signaling messages to call room participants using the OpenIM React Native SDK.
Broadcast application-defined signaling data to active participants in a calling room—such as hand-raising, custom reactions, or layout mode changes. customInfo accepts a string payload; serialize structured data as a JSON string before dispatching.
await OpenIMSDK.signalingSendCustomSignal({
roomID,
customInfo: JSON.stringify({
type: 'hand-raised',
}),
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
roomID | string | Yes | Target calling room ID. |
customInfo | string | Yes | Application-defined signaling content payload. |
Return value
A resolved Promise confirms that the custom signaling message was processed and forwarded by the server.
Receive custom signals
When other participants send custom signals, the SDK triggers the OnReceiveCustomSignal event. Its payload is typed as OnReceiveCustomSignalPayload, containing roomID and customInfo. Match the calling room using roomID before deserializing the business payload.
function handleCustomSignal(payload: OnReceiveCustomSignalPayload) {
if (payload.roomID === currentRoomID) {
const data = JSON.parse(payload.customInfo);
// Handle application signaling event
}
}
// Register listener
OpenIMSDK.on(OpenIMEvent.OnReceiveCustomSignal, handleCustomSignal);
// Remove listener
OpenIMSDK.off(OpenIMEvent.OnReceiveCustomSignal, handleCustomSignal);Unregister this listener when the call screen unmounts, the user signs out, or accounts switch.
Was this page helpful?