Closed carmenlau closed 6 years ago
Need further check the following scenario
JS
iOS and Android
@howawong Would like to know any findings or updates so far? About JS reconnect and the reconnection in react native. Thanks!!
talked to @chpapa last friday. I think it is the expected behavior of pubsub as it is not expected to receive any message sent from plugin after the connection is lost and even the connection is recovered. I think we either have
getMessages
in pubsub listener onOpen
in UIKitThe first approach is probably too big for now, I think we can stick to the second approach.
and @chpapa found the issue in Android/ iOS
FYI, JS SDK has implemented _reconnect
. It is called whenever a connection is closed.
@carmenlau I had verified with chat-SDK-JS demo, the reconnection works as expected.
Further tested with react native sample code, the reconnection still works after switching different apps, turning off screen and airplane mode.
@carmenlau , @chpapa
As discussed, the pub/sub is not persistent. Therefore it is best to call getMessages()
whether pub/sub connection is established.
Sample Code
function refresh() {
skygearChat.getMessages(conversation, limit, beforeTime)
.then(function (messages) {
//Update the UI with new messages
});
}
const refreshHandler = skygear.pubsub.onOpen(refresh);
Meanwhile, there is an issue regarding pub/sub SkygearIO/skygear-server#556.
Check the client app, it looks like it is not related to the connection status. The user never get any message after enter the room, for the room has around 200 people.
Some time subscribe to a conversation failed. It looks like if all messages in a room are marked as read, subscribe to conversation doesn’t work. Not 100% sure. Need verify.
Reported user is using JS SDK in hybrid app.