Skip to content

isReady may remain false in MessageListWeb #3080

@jainkuniya

Description

@jainkuniya

We are using postMessage to communicate between react app and message list (i.e WebView).
postMessage is acting as a bridge between whole app and webView.
Whenever there is a update in app e.g.: typing events or new message etc we send html content to WebView via this postMessage bridge. And similarly we get scroll, touch/click events from WebView (Message List) to react native app via the same bridge postMessage.

https://github.com/zulip/zulip-mobile/blob/master/docs/architecture/react.md#the-exception-messagelistweb

One thing we need to make sure is, bridge should be successfully established before we start communication between two components. Else we will be sending messages from one side while the other side is not yet ready to receive/process messages. Thus this will cause in consistency and the updates will not be observed in the real time.

On current master, we are sending isReady message whenever webView is ready to receive/send/process messages. But the the problem is, what if when webView send isReady message at that time RN part is not ready or this event is not received by RN? We are just ignoring this case currently.
Then according to this RN will always thinks that webView is not ready and will never send any new message to webView, and keep on waiting till it hears isReady from webView.

On current master, one way hand shake is implemented (explained in above paragraph).

Which starts causing problems on Android 9. Issue like:

oh, it's a mix. Sometimes loading bars, sometimes not

(https://chat.zulip.org/#narrow/stream/48-mobile/subject/messages.20don't.20load/near/655849)

  • etc etc (actually whole communication seems to be broken)

Solution: Improve/enhance this hand shaking mechanism. Implement a two way hand shake.
Keep sending a message from one side till a confirmation from other side is heard/received.
I will prefer to keep this one side as RN one, because we have more control on RN one and it is easier to debug in RN.

(Sending PR in few minutes)

@zulipbot claim

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions