Browse SDKs · React Native
SDKsReact Native

Send a custom signal

Send a custom signal in a call room.

Copy

Call signalingSendCustomSignal() to send an application-defined signal to a call room, such as raising a hand or changing the layout. customInfo is a string. To send structured data, pass a JSON string.

await OpenIMSDK.signalingSendCustomSignal({
  roomID,
  customInfo: JSON.stringify({
    type: 'hand-raised',
  }),
});

Parameters

ParameterTypeDescription
roomIDstringTarget call room ID.
customInfostringApplication-defined signal content.

After the call returns, the custom-signal request is complete.

Receive custom signals

When another participant sends a custom signal, OnReceiveCustomSignal is triggered. Its callback parameter is OnReceiveCustomSignalPayload, which contains roomID and customInfo.

function handleCustomSignal(payload: OnReceiveCustomSignalPayload) {
  // ...
}

// Start listening
OpenIMSDK.on(OpenIMEvent.OnReceiveCustomSignal, handleCustomSignal);

// Stop listening
OpenIMSDK.off(OpenIMEvent.OnReceiveCustomSignal, handleCustomSignal);

Stop listening when the component is unmounted, the user signs out, or the account changes. After receiving customInfo, parse and handle its data according to the application protocol.