ConnectyCube / connectycube-reactnative-samples

Chat and Video Chat code samples for React Native, ConnectyCube
https://connectycube.com
Apache License 2.0
124 stars 111 forks source link

onStop extension is received mutated #66

Closed whenmoon closed 4 years ago

whenmoon commented 4 years ago

If an opponent stops a call, I am expecting to be able to receive an object they pass to session.stop(extension) inside my onStop listener.

I pass an object to session.stop(myObject):

stopCall(session, { stopType: STOP_TYPE_TIME_OUT });

const stopCall = (session, extension = {}) => {
  session.stop(extension);
};

Then on the other opponents end inside the onStop listener I receive the extension:

ConnectyCube.videochat.onStopCallListener = (session, id, extension) => {
  console.log(extension);
};

However the extension object received looks like this:

Screenshot 2020-04-26 at 14 28 12

It is not the same object I sent but the properties are buried in there somewhere. It is not a plain object like it is when I follow the same pattern but with session.call(myObject).

How can I receive the extension I sent like when using session.call({}) ?

banshiAnton commented 4 years ago

Hi @whenmoon, I will test the code and let you know

banshiAnton commented 4 years ago

I have tested on sdk 2.1.6 and all works well. Please can you provide sdk version and you extension object example (it is { stopType: STOP_TYPE_TIME_OUT } ) what is variable type of STOP_TYPE_TIME_OUT

whenmoon commented 4 years ago

Hi @banshiAnton thanks for the quick reply - I am using SDK version ^1.8.1 and type of STOP_TYPE_TIME_OUT is string

banshiAnton commented 4 years ago

Hi @whenmoon as fast solution try extension with minimum 2 props for example

const extension = { stopType: STOP_TYPE_TIME_OUT, prop: '1' }
session.stop(extension);

// listener
ConnectyCube.videochat.onStopCallListener = (session, id, extension) => {
  delete extension.prop
  console.log(extension);
};
whenmoon commented 4 years ago

Hi @banshiAnton, thank you ok I will try that - in the meantime I tried updating to a new SDK as you said you had it working fully on v2.1.6, but I ran in to this problem:

https://github.com/ConnectyCube/connectycube-reactnative-samples/issues/68

Any ideas what could be the problem here?

banshiAnton commented 4 years ago

Our dev team start investigate that issue

whenmoon commented 4 years ago

Hi @banshiAnton I resolved the above issue and got this working correctly on v3.0.1, thanks for your help!