Yes, I am using EU region should I change it?
your comment was not helpful
here is my initialization:
Future<void> initAmity(User? user) async {
try {
await AmityCoreClient.setup(
sycInitialization: true,
option: AmityCoreClientOption(
apiKey: appConfig.amityApiKey,
httpEndpoint: AmityRegionalHttpEndpoint.EU,
mqttEndpoint: AmityRegionalMqttEndpoint.EU,
),
);
_loginUser(user);
} on AmityException catch (e) {
log('AmityException ${e.message}');
} catch (e) {
log('AmityError $e');
}
}
message fetching code:
observeMessages(String channelId) {
final collection = AmityChatClient.newMessageRepository()
.getMessages(channelId)
.stackFromEnd(true)
.includingTags([])
.excludingTags([])
.includeDeleted(true)
.filterByParent(false)
.getLiveCollection();
collection.loadNext();
collection.getStreamController().stream.listen(
(messages) {
print(messages);
},
onError: (e) {
print(e);
},
);
}
before fetched messages I also fetching communities, they works fine, here is how I do it:
Stream<List<AmityCommunity>> queryCommunitiesStream(
AmityCommunitySortOption sortOption,
AmityCommunityFilter filter,
) {
final CommunityLiveCollection liveCollection =
AmitySocialClient.newCommunityRepository()
.getCommunities()
.filter(filter)
.sortBy(sortOption)
.includeDeleted(true)
.getLiveCollection();
liveCollection.loadNext();
return liveCollection.getStreamController().stream;
}
Also on send message I receive Error on try catch block - Message feed not found
, here is code sample:
Future<void> sendMessage(String channelId, String text) async {
try {
await AmityChatClient.newChannelRepository().joinChannel(channelId);
final message = await AmityChatClient.newMessageRepository()
.createMessage(channelId)
.text(text)
.send();
log("Message sent: ${message.messageId}");
} catch (e) {
log("sendMessage Error: $e");
}
}
On trying addMessageReaction
- Unhandled Exception: Parameters validation error!
, here is code sample:
void addMessageReaction(AmityMessage message) {
message
.react()
.addReaction('like')
.then((value) => {log('value reacted ${value}')});
}
So, I suppose there is a bug on your side with initial fetching messages, sending messages, and sending reactions at least.
Please resolve them.