getting [Error: Amity SDK (800000): Connection closed]
Error:
502 Bad Gateway
in react native when staying in
useEffect(() => {
SubChannelRepository.startReading(channel.channelId);
const msgSub = MessageRepository.getMessages(
{subChannelId: channel.channelId, limit: 18, type: ‘text’},
({data, …metadata}) => {
console.log(metadata.error?.message);
if (!metadata.loading) {
setLoading(false);
setMessages(data as Amity.Message<'text'>[]);
}
setLoadingMore(metadata.loading);
setHasNextPage(metadata.hasNextPage ?? false);
if (metadata.onNextPage) {
onNextPage.current = metadata.onNextPage;
}
},
);
// console.log(msgSub);
return () => {
msgSub();
SubChannelRepository.stopReading(channel.channelId);
};
}, [channel.channelId]);