Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conversation.streamMessages() not working in React-native #223

Closed
HassenMabrouki opened this issue Nov 16, 2022 · 6 comments
Closed

conversation.streamMessages() not working in React-native #223

HassenMabrouki opened this issue Nov 16, 2022 · 6 comments
Assignees

Comments

@HassenMabrouki
Copy link

HassenMabrouki commented Nov 16, 2022

Context

Attempting to use xmtp-js in React Native, I successfully integrate the SDK, I can send messages, and also get the messages list works fine.

Problem

Listen for new messages in a conversation it's not working

for await (const message of await conversation.streamMessages()) {
  if (message.senderAddress === xmtp.address) {
    // This message was sent from me
    continue
  }
  console.log(`New message from ${message.senderAddress}: ${message.content}`)
}

Screenshot

Screen Shot 2022-11-16 at 12 11 51 PM
Screen Shot 2022-11-16 at 12 14 23 PM

Expectation

As I followed the documentation, the expected result whenever I send a message from user A to user B, the message should be displayed for user B, but it is not the case for me.

@elisealix22 elisealix22 self-assigned this Nov 16, 2022
@elisealix22
Copy link
Contributor

Thank you for the detailed write up. I'll take a look 👀

@shipunyc
Copy link

Any updates on this issue?

Any quick fix?

@elisealix22
Copy link
Contributor

I'm switching to this one now. Will report back early next week with my findings!

@elisealix22
Copy link
Contributor

Just want to pop in and say this is still under investigation. I did find one issue in testing messagesPaginated which uses an AsyncGenerator under the hood. In that case, Promise.settleAll() was undefined though so it seems to be a separate issue. facebook/hermes#766

Will continue to report progress as we dig in.

@elisealix22
Copy link
Contributor

@HassenMabrouki @shipunyc I have a streaming demo working over in the example repo! You can find more information in the PR description, but let me know if you run into any trouble with this approach.

xmtp/example-chat-react-native#8

@nplasterer
Copy link
Contributor

Closing this out because of inactivity. Please feel free to reopen if you're still having issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants