How to listen to CHAT events in JS with custom jitsi-meet build

For a React Native App, I have a custom JitsiMeetSDK (both iOS and Android) that I use via a react-native jitsi meet library wrapper.

I want to hook up to the OPEN_CHAT/CLOSE_CHAT/TOGGLE_CHAT events in my app’s JavaScript. How can I do that?

I saw these files:
jitsi-meet/blob/master/android/sdk/src/main/java/org/jitsi/meet/sdk/ExternalAPIModule.java
itsi-meet/blob/master/ios/sdk/src/ExternalAPI.m
jitsi-meet/blob/master/react/features/mobile/external-api/middleware.js

So these events seem to be present in Jitsi’s custom SDK’s JS and native Android and iOS parts. So I want to get them either directly to my app’s JS or to my react-native jitsi wrapper library and then to my app’s JS.
I’m currently using this RN wrapper: GitHub - vidit-me/react-native-jitsi-meet and I force it to use my custom sdk build for iOS and Android

Thank you very much for the answer and for all the work for Jitsi!

You can follow how other events are sent over to the native side on those files, since it’s 2 different mechanisms: a notification on iOS and a broadcast event on Android.

I did look into how other events are passed and I managed to make it work on Android - a custom event for when the chat button is pressed that is fired from jitsi custom sdk, to native, to my app.

On iOS, when I follow the same flow by association - adding the new custom event in the iOS native part of Jitsi Meet custom SDK, the adding it in the react native wrapper library which I use (GitHub - vidit-me/react-native-jitsi-meet).

Then I add the custom event in node_modules/@vidit-me/react-native-jitsi-meet/ios/RNJitsiMeetView.swift - the same way these 3 events are there: onConferenceWillJoin, onConferenceJoined, onConferenceTerminated - yet nothing happens - I can’t hook to my custom event in iOS

Show what code you added for the iOS part please.

I think I found what the issue is: At first I had my new custom event “CHAT_BUTTON_ON_PRESS”. In ios/sdk/src/ExternalAPI.m was getting mapped to the function chatButtonOnPress via ‘methodNameFromEventName’. Then I had to use that in @vidit-me/react-native-jitsi-meet library’s Swift file (extension RNJitsiMeetView: JitsiMeetViewDelegate… ) but having the method there named “chatButtonOnPress” seemed to result in a swift compiler error. For some reason Swift wasn’t happy with the naming so I had to change the name to ‘chatButtonPress’. Then in ios/sdk/src/ExternalAPI.m I added a condition for the event name of “CHAT_BUTTON_ON_PRESS” to get “SEL sel = NSSelectorFromString(@“chatButtonPress:”);” rather than relying on “methodNameFromEventName” for this event.

Not sure if I explained it in the best way possible but it seems to be working now. Obviously I’m not familiar with Obj C and Swift at all so it took me a while to figure that out.

Thank you very much for all your work and the great community!

Glad you figured it out!