When your app becomes disconnected from Stringee server, you cannot receive real-time updates. In this case, you use Stringee Push Notification to keep your app's data updated.
Check Flutter Push Notification to create an iOS push project on Stringee dashboard and generate APNs Auth Key for push notification.
Stringee use Remote Push Notification to send push to devices for chat. So, you need to do the following steps:
In Flutter, you can use any library to get APNS device token for push. For example, if you are using FlutterFire, you can call the following function to get that token:
FirebaseMessaging.instance.getAPNSToken();
Send your device token to Stringee server as follows:
InstanceManager.client.registerPush(pushToken, isProduction: false, isVoip: false).then((result) {
bool status = result['status'];
String message = result['message'];
print('Result for resgister push: ' + message);
});
If everything is success, you will receive remote push notifications for chat. Stringee push notification data has the following format:
{
data = {
map = {
data = {
map = {
avatarUrl = "";
convId = "conv-vn-1-OZQMBPBUWM-1553965638358";
convName = Demo;
createdTime = 1554261740264;
displayName = hoangnam;
from = user1;
isGroup = 0;
message = {
map = {
content = Alo;
metadata = {
map = {};
};
};
};
msgId = "msg-vn-1-OZQMBPBUWM-1553965654245";
seq = 2;
type = 1;
};
};
stringeePushNotification = "1.0";
type = "CHAT_EVENT";
};
};
}