Comet chat failing and app crashing when no network is available

I am using comet chat react native package. Send message function is failing when there is no internet connection and it’s crashing the app. I have used the error callback for the sendMessage function, but not working.

1 Like

@arunnambissan, we have created a github issue for it, you can follow the issue here. we shall be fixing it on priority basis.

Hello @arunnambissan,

Can you please let us know in which version of the SDK are you facing this issue?

I am using the below version in my pckage.json file;

@cometchat-pro/react-native-chat”: “^2.0.7”

Hello @arunnambissan,

Can you please update to the latest version 2.0.8 and check if you are still facing this issue?

1 Like

Ok. I will try that.

1 Like

Now the mentioned error is not throwing. But it’s not going inside the catch callback when there is no internet.

CometChat.sendMessage(textMessage).then(
                    message => {
                        console.log("Message sent successfully:", message);
                        resolve(message);
                    },
                    error => {
                        console.log("Message sending failed with error:", error);
                        reject(error)
                    }
);

Hello @arunnambissan,

We have noted this issue and also added a fix for this. This will be fixed in the next release. Please follow the GitHub issue(shared above) to stay updated on the progress.

Warm Regards,

Mayur Bhandari
CometChat Pro

Ok. I will check. Thank you.

1 Like