Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onMessage listener is not always being triggered onMessage from the web app which is also using react connectycube chat #97

Open
HusseinY-DeV opened this issue Sep 1, 2021 · 5 comments

Comments

@HusseinY-DeV
Copy link

HusseinY-DeV commented Sep 1, 2021

    ConnectyCube.chat.onMessageListener = this.onMessageListener;
onMessageListener = (senderId, msg) => {
    Alert.alert("LISTENED", JSON.stringify(senderId));
    store.dispatch({ type: "UPDATE_DIALOG", payload: msg });
};


setUpListeners() {
    ConnectyCube.chat.onMessageListener = this.onMessageListener;
    AppState.addEventListener('change', this.handleAppStateChange);
}

i am calling setUpListeners on the didMount of the stack that will be holding all the dialogs and chats altho it doesnt seem to be triggered, it gets triggered sometimes when i disconnect programmatically the alerts appear

@DaveLomber
Copy link
Contributor

Could you provide a snippet how you send a message from Web

@HusseinY-DeV
Copy link
Author

Could you provide a snippet how you send a message from Web

The message sent is from the connectycube chat web sample i changed nothing ,only the app config credentials so that i could connect to my connectycube app

@DaveLomber
Copy link
Contributor

Ok then let's do the following

at RN side:

1 - enable logs

const CONFIG = {
  debug: { mode: 1 }, // enable DEBUG mode (mode 0 is logs off, mode 1 -> console.log())
};
ConnectyCube.init(CREDENTIALS, CONFIG);

2 - send a message from Web. then collect ALL SDK logs at RN side and share here

@HusseinY-DeV
Copy link
Author

Ok then let's do the following

at RN side:

1 - enable logs

const CONFIG = {
  debug: { mode: 1 }, // enable DEBUG mode (mode 0 is logs off, mode 1 -> console.log())
};
ConnectyCube.init(CREDENTIALS, CONFIG);

2 - send a message from Web. then collect ALL SDK logs at RN side and share here

Yes sir. Danke

@HusseinY-DeV
Copy link
Author

Ok then let's do the following
at RN side:
1 - enable logs

const CONFIG = {
  debug: { mode: 1 }, // enable DEBUG mode (mode 0 is logs off, mode 1 -> console.log())
};
ConnectyCube.init(CREDENTIALS, CONFIG);

2 - send a message from Web. then collect ALL SDK logs at RN side and share here

Yes sir. Danke

Here are the logs :

[Request][1] POST https://api.connectycube.com/session.json {type: "POST", url: "https://api.connectycube.com/session.json", data: {…}}
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Response][1] {session: {…}}
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] Connect with parameters {userId: 4781116, password: "12345678"}
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status connecting wss://chat.connectycube.com:5291
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status connect
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] CONNECTING
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status opening
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status open
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">PLAINANONYMOUSPLAIN_FASTzlib</stream:features>
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT: ADQ3ODExMTYtNTE3OAAxMjM0NTY3OA==
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status opening
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status open
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV: <stream:features xmlns:stream="http://etherx.jabber.org/streams">zlib</stream:features>
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV: [email protected]/1206818911-chat-1053372
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] status online [email protected]/1206818911-chat-1053372
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] ONLINE
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] CONNECTED
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Request][2] GET https://api.connectycube.com/chat/Dialog.json {type: "GET", url: "https://api.connectycube.com/chat/Dialog.json", data: {…}}
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] RECV:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Chat] SENT:
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\node_modules\react-native-connectycube\lib\cubeInternalUtils.js:115 [Response][2] {total_entries: 1, skip: 0, limit: 100, items: Array(1)}
C:\Users\hussein.alhusseiny\Desktop\Projects\connectycube-reactnative-samples\RNVideoChatConf\src\components\ChatScreen\Dialog.js:10 ITEM {_id: "6128d43520b3e30028b5f171", user_id: 4785404, created_at: "2021-08-27T12:01:57Z", updated_at: "2021-09-01T07:37:15Z", name: "WebUser", …}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants