I am following the documentation given here:
to set up Sendbird Syncmanager in a Javascript Application
"sendbird": “^3.0.140”,
"sendbird-syncmanager": "^1.1.21"
I am able to retrieve the channel list, but it is not working in iOS Safari. When checked with window.onerror
I am getting the error message as shown in the image attached.
Also see the image of the source code where the error is coming.
My code is given below:
const sb = new SendBird({
appId: <app id here> });
SendBirdSyncManager.sendBird = sb;
const options = new SendBirdSyncManager.Options();
options.messageCollectionCapacity = 2000;
options.messageResendPolicy = "automatic";
options.automaticMessageResendRetryCount = 5;
options.maxFailedMessageCountPerChannel = 50;
options.failedMessageRetentionDays = 7;
SendBirdSyncManager.setup("BHVVX71", options, () => {
sb.connect("BHVVX71")
.then((user) => {
const query = sb.GroupChannel.createMyGroupChannelListQuery();
const collection = new SendBirdSyncManager.ChannelCollection(query);
const handler = new SendBirdSyncManager.ChannelCollection.CollectionHandler();
handler.onChannelEvent = (action, channels = []) => {
switch (action) {
case "insert":
channels.map((item) => {
const app = document.querySelector("#root");
app.innerHTML += `<div>${item.name}</div>`;
});
// TODO: Add channels to the view.
break;
}
};
collection.setCollectionHandler(handler);
collection.fetch();
})
.catch(() => {});
});
window.onerror = function (message, source, lineno, colno, error) {
alert(message);
};
The same code is working in iOS Safari when developer tool is open and it lists all the channels without showing any error. See the last image in the attachment
Please let me know if this some issue in the code.
Thanks