agoraio / agora-react-native-rtm Goto Github PK
View Code? Open in Web Editor NEWReact Native around the Agora RTM SDKs for Android and iOS agora
Home Page: https://www.agora.io/en/
License: MIT License
React Native around the Agora RTM SDKs for Android and iOS agora
Home Page: https://www.agora.io/en/
License: MIT License
Im getting a error in xcode when getUserAttributes is called after a new user joins the channel.
Error occurs at AgoraRTM.m line 286 [self.rtmKit getUserAllAttributes
How can I resolve this. Happens 100% of times
The type for RTMEventCallback is defined as export declare type RTMEventCallback = () => {};
which seems incorrect as it gives a lint error on usage of the callback.
For example:
this._rtmEngine.on('error', (evt) => {
console.log(evt);
});
Gives an error - Argument of type '(evt: any) => void' is not assignable to parameter of type 'RTMEventCallback'.
Edit: I see the code for the correct types on this repo but it's not available in the latest stable version released to NPM. Is there a possibility to push a fix for the stable release, so that the users aren't thrown off by linter errors till the alpha version is released?
This is the code in my componentWillUnmount()
method:
async componentWillUnmount() {
console.log("Unmounting");
await this.state.rtmEngine.leaveChannel("testChatChannel").catch(error => console.log("Error leaving", error.code));;
await this.state.rtmEngine.logout().catch(error => console.log("Error logging out", error.code));
console.log("Left channel...");
}
I intermittently get the following error (see uploaded image):
What's going on here?
Hello,
I tested in simulator and devices on development environment but after deploy the app (Android Apk) the event didn't triggered. Is there an one more step to do before deploy the app that I've supposed missed?
"agora-react-native-rtm": "^1.2.2-alpha.3"
System:
OS: macOS 11.3
CPU: (8) arm64 Apple M1
Memory: 169.17 MB / 8.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.17.0 - /opt/homebrew/opt/node@14/bin/node
Yarn: 1.22.10 - /opt/homebrew/bin/yarn
npm: 6.14.13 - /opt/homebrew/opt/node@14/bin/npm
Watchman: 4.9.0 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK: Not Found
IDEs:
Android Studio: 4.2 AI-202.7660.26.42.7351085
Xcode: 12.5/12E262 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.64.1 => 0.64.1
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Will this library be updated so that it's compatible with CocoaPods projects that rely on use_frameworks!
? Currently, it fails to pass the pod install
step due to the following error:
[!] The 'Pods-Project' target has transitive dependencies that include statically linked binaries:
(/SRCROOT/ios/Pods/AgoraRtm_iOS/AgoraRtmKit.framework)
In comparison, the react-native-agora
library which exposes the RTC SDK works fine. Currently, the Agora developer blog recommends using the RTM SDK alongside the RTC SDK because the former supports methods to track chat room membership. However, this implementation is unfeasible on React Native for projects that rely on use_frameworks!
. Since both projects seem to share maintainers, I figured I'd ask. Thanks for all your hard work!
Does the channelname in RTM correspond to the channelname in video chat, or are they separate systems?
"agora-react-native-rtm": "^1.5.0",
"react": "17.0.2",
"react-native": "0.66.4",
RemoteInvitationAccepted--- {"callerId": "2", "channelId": "", "content": "", "hash": 105553150592080, "state": 4}
RemoteInvitationRefused--- {"callerId": "2", "channelId": "", "content": "", "hash": 105553150623984, "state": 3}
sendLocalInvitationV2、cancelLocalInvitationV2 正常
而且监听回来的 state 正好反了,切换到旧版 acceptRemoteInvitation、refuseRemoteInvitation 可以收到信息。不知道是SDK问题还是配置不对
React native github example project when we try to run this project We are trying to login with random UID and connect with Agora APP id in sandbox account. Its show login failed. After we are try Agora live Agora App id to login with UId and Token. Its show same login failed error
Hello.
This module is build well in gradle 3.x.x.
But can not build in gradle 4.x.x.
[error]
FAILURE: Build failed with an exception.
Could not resolve all artifacts for configuration ':agora-react-native-rtm:debugCompileClasspath'.
Could not find rtm-sdk-1.4.7.jar (com.github.agorabuilder:rtm-sdk:1.4.7).
Searched in the following locations:
https://www.jitpack.io/com/github/agorabuilder/rtm-sdk/1.4.7/rtm-sdk-1.4.7.jar
[version]
"agora-react-native-rtm": "^1.4.8",
"react": "16.13.1",
"react-native": "0.63.3",
Hi guys,
I wanna integrate the plugin in my react native project in order to make video&messaging chat, unfortunately i can't even make the sample project work.
Bellow some screenshots of bug i am facing while integrating the plugin in my own demo:
And bellow bug while running your example:
This is my working environment:
Thank you so much in advance for any kind of help or information
Hey there. I'm using agora-react-native-rtm
to handle user join subscriptions for audio broadcasting. It works fine on simulator & my iPhone X on iOS 14 (the users list updates & all events are properly fired off). However, on my iPhone 12 Pro running iOS 14.4.1 the rtmEngine
events fail to fire for seemingly no reason. They simply return a generic Error object w/ no message. rtcEngine
works properly and I'm able to connect + hear audio coming from the iPhone 12 Pro, so just an rtmEngine
issue here. Any ideas on what might be going wrong?
Errors (as you can see I tried logging the message
and name
of the first Error object but it doesn't contain any useful info):
Here's a snippet of the startCall
method. The first await
for rtcEngine succeeds but the subsequent 3 awaits
for rtmEngine fail (only on iPhone 12 Pro running iOS 14.4.1).
P.S. agora-react-native-rtm
is on version ^1.2.2-alpha.6
and react-native-agora
is ^3.3.1
.
Thanks!
@ReactMethod
public void leaveChannel(String channelId, Promise promise) {
RtmChannel rtmChannel = channels.get(channelId);
if (rtmChannel == null) {
promise.reject("-1", "channel_not_found");
} else {
rtmChannel.leave(new ResultCallback<Void>() {
@Override
public void onSuccess(Void aVoid) {
rtmChannel.release();
channels.remove(channelId);
promise.resolve(null);
}
@Override
public void onFailure(ErrorInfo errorInfo) {
promise.reject(String.valueOf(errorInfo.getErrorCode()), errorInfo.getErrorDescription());
}
});
}
}
I have traced the issue to this method, seems like all is good until we call rtmChannel.release()
which just hangs. Logcat just prints the error E/AGORA_SDK: cannot open log file for writing: agorartm.log, err=30
Hi there,
The native RTM sdk does support sending file and image messages. May I ask if we have a plan to support that feature in RN as well?
Thanks.
很负责的说,包括RTC的库,我们使用了,有好几处bug 以及引起的各种恶心的闪退/卡死问题(Android),我们长时间寻找问题根源,一处问题是官方文档写了不能使用的方式(很不起眼的角落注明的)这个库也用了,导致APP卡死。闪退问题更是恶心,这个库闪退是100%存在。不用怀疑,特别是初次使用就会出现。不要说是我们代码功底,逻辑思维什么之类的问题。于是我们在不得已尝试多个方法后在崩溃边缘猜测的最后一个可能,终于解决了。但是我不会分享这些问题的根本原因及解决方法,因为官方的支持也是很恶心的各种抬杠。
对于这种官方出的库,不用说测试不全面了,很多基本测试都没有。所以谁用谁认灾吧。祝你们好运!!!呵呵
Hello, does this library have support for RN 0.60? I am using RN 0.60.5 and I need to integrate the chat option, I am already using Agora RN VideoCall.
Thanks.
Hi,
I am new to react native,
We have used [email protected] before it got deprecated,
And I can't able to connect video calls and gets lot of warning in my code,
So I decided to update new agora package and I have updated to react-native-agora 3.5.2,
But I am getting TypeError: null is not an object (evaluating 'Agora.FPS30') in index.bundle,
Any suggestion or idea to solve this issue
ERROR TypeError: null is not an object (evaluating 'Agora.FPS30')
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
ERROR Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
@LichKing-2234, @plutoless, @RoJoHub can you help on this.
I'm using sendMessageToPeerV2
to send message and when there's an Error, I'll make the message a failed message to let users to resend.
There's an issue that, the offline message (I enabled this) will also trigger an error (I saw the error code from Android app, it's Error: PEER_MESSAGE_ERR_CACHED_BY_SERVER
)
It's fine, I can exclude this if I know the error type, but the issue is when it comes to ios, it does not give any error code or error description. It only returns Error
. It means every offline message will become failed message.
Anyone has a good workaround? Thanks.
Demo 只实现了最基本的登录、频道消息监听。在我本地测试时其他的大部分事件都没有反应,而且很多操作在官方的文档中也没有说明,例如呼叫类的事件,不知道是先 login 后 joinChannel 还是怎么才能监听到
Why are all the functions deprecated?
createClient(), login() etc
Hi!,
RN RTM SDK does support for enable historical messages?.
In the web version the parameter enableHistoricalMessaging: true was sent a channel message.
Thanks.
Hey!
I'm currently working with version 1.2.2-alpha.2
and am trying to setup a basic messaging service for a live stream. I can get the client to login and join the channel, but none of the event listeners fire. The only one that does fire is connectionStateChanged
. Is this a know issue or something that anyone has any insight on? Can offer more info, not sure what would be most useful.
There are no raw RTM messages in this React Native library for RTM.
Is there a way we can add this support?
Also callbacks for image and file messages are empty for Android, as well as upload progress methods:
The same callback methods are missing for iOS too.
hi, i created a channel named 'My channel
' and sent message to the channel and that was successful But when i refreshed the app and sent the message again there was an error .
The problem is that i always have to create the channel whenever i reloads the app to send a message.
Isnt it allowd to retrive the channel from agora when refreshed.
Hello,
I am running into issues running my app after install this dependency on an M1 machine. I am running
React Native: 66.3
agora-react-native-rtm: 1.4.8
xcode: 13.1
Machine: Apple M1
When running the app, I get:
ld: building for iOS Simulator, but linking in dylib built for iOS, file '/Users/gustavodelpino/dev/blink/BlinkMobile/ios/Pods/AgoraRtm_iOS/AgoraRtmKit.framework/AgoraRtmKit' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I appreciate any help you can provide!
Does this sdk not have the channel attribute operations like get and set channel attributes?
I am compiling my app via Bitrise and I am getting this compilation error:
Task :agora-react-native-rtm:compileReleaseJavaWithJavac FAILED
/bitrise/src/mobile-app/node_modules/agora-react-native-rtm/android/src/main/java/io/agora/agora_rtm/AgoraRTMModule.java:3: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
/bitrise/src/mobile-app/node_modules/agora-react-native-rtm/android/src/main/java/io/agora/agora_rtm/AgoraRTMModule.java:73: error: cannot find symbol
private void sendEvent(String eventName, @nullable WritableMap params) {
^
symbol: class Nullable
location: class AgoraRTMModule
2 errors
FAILURE: Build failed with an exception.
which comes from here:
Any ideas what the problem is? I have androidX and jetifier enabled:
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
Hello, I'm using agora-react-native-rtm to handle call invitation. It works fine on Android, However, on iOS the acceptRemoteInvitationV2 method fails with error code 1.
I'm using
react-native: 0.66.4
xcode: 12.5.1
agora-react-native-rtm: 1.4.8
can anyone please suggest me any solution for this @plutoless @LichKing-2234 @Matrixbirds @vitoresende ?
hi, I am using agora in react native for Real time messages. i want to knao that how can i get the prevoius messages from a particular channel. Also want to know that does agora saves our peer to peer chats nad shows the details of channels.
Please Help ........
Hello. I am not sure if this is a known issue or I am doing something wrong but I am struggling with the events for messages: channelMessageReceived and messageReceived which as far as I see they are not called. They are attached in a function (initRTM) that is called in componentDidMount() of the component. Here is the complete code: https://pastebin.com/XL3XUDYM Do you have any idea about what the possible issue might be?
Also I can confirm that the messages are sent using .sendMessageByChannelId() since the .done() method is called on it. The only issue that remains is that once I send a message using sendMessageByChannelId, I expect an event to be called (no event is triggered). Neither messageReceived or channelMessageReceived are called. They appear to not respond to anything and I am not able to find out why…
I'm using Agora 3.2.2 and Agora RTM 1.2.2-alpha.6
Any idea why this happens?
发起视频邀请是怎么实现的
login error
RTMError: 5
join error
RTMError: 102
async login(uid: string): Promise<any> {
this.client.createClient(APP_ID);
return this.client.login({
token: `${TOKEN}`,
uid,
});
}
async join(cid: string): Promise<any> {
return this.client.joinChannel(cid);
}
I enabled App Certificate
I leave the channel by client.leaveChannel(), but then when i try to join some other / the same channel with client.joinChannel(), the app crashes on android. iOS works fine though.
also the client.on('error', callback) is not fired when the crash occurs.
I am trying to integrate agora-react-native-rtm in my project which is pure ES6 and no typescript code base. I want to use agora livestream along with agora-rtm for messaging.
Based on the example in agora-react-native-rtm/example, I have created rtm-adapter which instantiates rtmEngine. But the moment I call rmtEngine.joinChannel(cid); it causes NPE.
The NPE is happening because the rtmClient instance in AgoraRTMModule.java is not created untill AgoraRTMModule::createInstance is called. From what I could gather, this is to be called from React side. But looking at the example in agora-react-native-rtm, I don't see any call to AgoraRTMModule::createInstance or AgoraRTMModule::createClient.
I tried to call createClient on rtmEngine instance, but it failed because it was unable to find the shared libs on the emulator. I copied the shared libs into android/app/src/main/jniLibs and the agora-rtm-sdj.jar into android/app/libs/ folder but now it complains of missing JNI method. Here is the stacktrace for the same.
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: Exception in native call
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: java.lang.RuntimeException: Could not invoke AgoraRTM.createInstance
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:383)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:151)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at android.os.Handler.handleCallback(Handler.java:883)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at android.os.Handler.dispatchMessage(Handler.java:100)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:27)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at android.os.Looper.loop(Looper.java:214)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run(MessageQueueThreadImpl.java:226)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at java.lang.Thread.run(Thread.java:919)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: Caused by: java.lang.reflect.InvocationTargetException
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at java.lang.reflect.Method.invoke(Native Method)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:372)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: ... 8 more
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: Caused by: java.lang.NoSuchMethodError: no static method "Lio/agora/rtm/jni/AgoraRtmServiceJNI;.SwigDirector_IChannelEventHandler_onImageMessageReceived(Lio/agora/rtm/jni/IChannelEventHandler;Ljava/lang/String;J)V"
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.jni.AgoraRtmServiceJNI.swig_module_init(Native Method)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.jni.AgoraRtmServiceJNI.<clinit>(AgoraRtmServiceJNI.java:329)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.jni.AgoraRtmServiceJNI.new_IRtmServiceEventHandler(Native Method)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.jni.IRtmServiceEventHandler.<init>(IRtmServiceEventHandler.java:54)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.internal.RtmClientImpl$RtmServiceEventHandlerNative.<init>(RtmClientImpl.java:946)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.internal.RtmClientImpl$RtmServiceEventHandlerNative.<init>(RtmClientImpl.java:946)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.internal.RtmClientImpl.initRtmService(RtmClientImpl.java:122)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.internal.RtmClientImpl.<init>(RtmClientImpl.java:100)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.internal.RtmManager.createRtmInstance(RtmManager.java:20)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.rtm.RtmClient.createInstance(RtmClient.java:63)
08-23 20:04:29.358 5542 5607 E unknown:ReactNative: at io.agora.agora_rtm.AgoraRTMModule.createInstance(AgoraRTMModule.java:314)
I understand that right now it is in alpha/beta stage but is there a way I can make it work for the time being at least on android?
I would appreciate any help.
Every other library documentations needs to have createChannel called before allowing to perform other channel related functions.
RTM Web
const channel = client.createChannel('demoChannelName'); // Pass your channel ID here.
RTM Android
mRtmChannel = mRtmClient.createChannel("demoChannelId", mRtmChannelListener);
Even tho [email protected] has joinChannel, leaveChannel methods, it doesn't have createChannel method. Am I on the correct library?
按照流程进行到 pod install 时提示
[!] CocoaPods could not find compatible versions for pod "AgoraRtm_iOS": In Podfile: agora-react-native-rtm (from `../node_modules/agora-react-native-rtm`) was resolved to 1.0.1-alpha.1, which depends on AgoraRtm_iOS (= 1.0.1)
然后修改 package.json 中的 agora-react-native-rtm 版本降级到 1.0.0-alpha.1 再次 pod install 后成功
用 Xcode 打开项目出现各种神奇的错误。。。。
所以我该如何解决问题?是因为 agora-react-native-rtm 版本问题还是项目相关库的构建问题?
Hi there, I get an error while compiling in Unity cloud Build:
`223: ⚠;️ /BUILD_PATH/superbytes.aiohealthpro1.default-ios/temp20200824-4537-1hlfgn2/Libraries/Plugins/DeepLink/Plugin/iOS/DeepLinkAppDelegate.m:23:16: 'application:openURL:sourceApplication:annotation:' is deprecated: first deprecated in iOS 9.0 [-Wdeprecated-declarations]
224: ⚠;️ /BUILD_PATH/superbytes.aiohealthpro1.default-ios/temp20200824-4537-1hlfgn2/Libraries/Plugins/DeepLink/Plugin/iOS/DeepLinkAppDelegate.m:28:9: returning 'NS_RETURNS_INNER_POINTER const char *' from a function with result type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
225: ⚠;️ ld: ignoring file /BUILD_PATH/superbytes.aiohealthpro1.default-ios/temp20200824-4537-1hlfgn2/Frameworks/AgoraEngine/Plugins/iOS/AgoraRtmIos.framework/AgoraRtmIos, building for iOS-armv7 but attempting to link with file built for iOS-arm64
226: ❌; Undefined symbols for architecture armv7
227: ❌; ld: symbol(s) not found for architecture armv7
228: ❌; clang: error: linker command failed with exit code 1 (use -v to see invocation)
229: publishing finished successfully.
230: Finished: FAILURE`
Do I need to delete any folder? Don't know if it's because of the Cloud Build and build Post Processing...
Unable to create channel in "agora-react-native-rtm": "^1.4.8"
. Checked the function is available in the docs. Is there a way to create channel from Agora dashboard as well?
Sending Message one to one
is not working
Hi,
i try to set a user attributes array once i logged in successfully into rtm client but it returns ATTRIBUTE_OPERATION_ERR_FAILURE and i cannot understand why!
This is the code
client.setLocalUserAttributes([
{
key: 'id',
value: `${this.props.user.id}`
},
{
key: 'name',
value: this.props.user.name
},
{
key: 'surname',
value: this.props.user.surname
},
]);
Any help?
Thanks
We are currently using the version 1.0.1-alpha.1 published on npmjs.
We are facing a good number of issues with event bindings, logout and destroy methods. We see that the latest code on Github has some fixes for multiple event bindings, but not sure if there are fixes for logout & destroy.
Would like to know if there is any upgrade planned anytime soon? or any beta/alpha versions which we can use?
Dear team,
While I was looking deeply into my project and try to run the application using Profile(Instruments) on Xcode for iOS project. Once I initialize the RTM in my code. I can be able to see a list of leaks in my "Leaks" profiling tool.
Attaching screenshot for your reference.
Does it have any affect to my application. Agora RTM is not consistent after I receive these kind of leaks.
Current version: "agora-react-native-rtm": "1.0.1-alpha.1"
Thanks & Regards
-Sayeed
I have added below code but now works for me, I when I'm try to get recent chat list then not getting any messages
Message History EndPoint:-
"https://api.agora.io/dev/v2/project/{{appId}}/rtm/message/history/query"
import RtmEngine from 'agora-react-native-rtm';
const APP_ID = ''
let engine;
import { EventRegister } from 'react-native-event-listeners'
class AgoraManager {
static loginUserUid = ''
static agoraInit = async(strEmail, strChatToken) => {
arrChatMessages = []
engine = new RtmEngine();
loginUserUid = strEmail
engine.on('error', evt => {
console.log(evt);
});
//4.Received Observer
engine.on('messageReceived', evt => {
let {text, ts, peerId} = evt;
let dictMessage = { user_id: peerId, message: text, msgTimeStamp: ts}
console.log("Message recievied =>", dictMessage);
EventRegister.emit('RECEIVE_NEW_MESSAGE', dictMessage)
});
//1. Create Client
await engine.createClient(APP_ID).catch(e => console.log(e));
//2. Login in agora
await engine.login({uid: loginUserUid, token: strChatToken})
}
static sendMessage = async (dictAgoraPeerMessage) => {
await engine.sendMessageToPeer(dictAgoraPeerMessage).then((data) => {
console.log("Send Message With Response =>",data)
}).catch((err) => {
console.log("Message Error =>",error)
})
}
static endChat = async () => {
await engine.logout().catch(e => console.log(e));
await engine.destroyClient().catch(e => console.log(e));
};
}
export { AgoraManager };
Chat.js
let dictMessage = { 'peerId': this.state.strReceiveUId, 'offline': true, 'text': this.state.strUserMessage.trim(),
const {response} = await AgoraManager.sendMessage(dictMessage)
AgoraRTM.m
// sendMessageToPeer
RCT_EXPORT_METHOD(sendMessageToPeer:
(NSDictionary *) params
resolve:
(RCTPromiseResolveBlock) resolve
reject:
(RCTPromiseRejectBlock) reject) {
BOOL offline = [params[@"offline"] boolValue];
NSString *text = params[@"text"];
NSString *peerId = params[@"peerId"];
AgoraRtmSendMessageOptions *options = [AgoraRtmSendMessageOptions new];
**[options setEnableHistoricalMessaging:true];**
[options setEnableOfflineMessaging:offline];
AgoraRtmMessage *message = [[AgoraRtmMessage new] initWithText:text];
[[self rtmKit] sendMessage:message toPeer:peerId sendMessageOptions:options completion:^(AgoraRtmSendPeerMessageErrorCode errorCode) {
if (errorCode == AgoraRtmSendPeerMessageErrorOk) {
resolve(nil);
} else {
reject(@(errorCode).stringValue, @"", nil);
}
}];
}
Please suggest me any solution for this.
Thank you
this._rtmEngine.on('messageReceived', (evt) => {
let { uid, channelId, text } = evt;
let data = text.split(':');
this.setState({rooms: {...this.state.rooms, [data[0]]: data[1]}});
});
i cant get any data return from this function, and i can sure i have success send out my message. Any idea how to solve it?
而
这个问题有遇到过吗?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.