Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Enable text streaming support for React Native (iOS and Android) on pubsub.subscribe #3488

Conversation

acostalima
Copy link

@acostalima acostalima commented Jan 18, 2021

React Native's Networking API accepts several arguments, two of which that:

The reception of incremental data is only supported when the native response type is set to 'text'. As such, @react-native-community/fetch, the implementation of the fetch API that provides text streaming support for React Native, accepts a custom option to drive the arguments mentioned above.

In the demo app, this option is currently included with a patch.

@welcome
Copy link

welcome bot commented Jan 18, 2021

Thank you for submitting this PR!
A maintainer will be here shortly to review it.
We are super grateful, but we are also overloaded! Help us by making sure that:

  • The context for this PR is clear, with relevant discussion, decisions
    and stakeholders linked/mentioned.

  • Your contribution itself is clear (code comments, self-review for the
    rest) and in its best form. Follow the code contribution
    guidelines

    if they apply.

Getting other community members to do a review would be great help too on complex PRs (you can ask in the chats/forums). If you are unsure about something, just leave us a comment.
Next steps:

  • A maintainer will triage and assign priority to this PR, commenting on
    any missing things and potentially assigning a reviewer for high
    priority items.

  • The PR gets reviews, discussed and approvals as needed.

  • The PR is merged by maintainers when it has been approved and comments addressed.

We currently aim to provide initial feedback/triaging within two business days. Please keep an eye on any labelling actions, as these will indicate priorities and status of your contribution.
We are very grateful for your contribution!

@acostalima acostalima changed the title Enable text streaming support for React Native in pubsub.subscribe Enable text streaming support for React Native on pubsub.subscribe Jan 19, 2021
@achingbrain
Copy link
Member

Pubsub subscriptions in the HTTP client are long-lived requests that for all intents and purposes may never end.

If I receive an arbitrary number of pubsub messages, and we get incremental data updates to process those messages, can responseText be reset or will it grow over time and eventually cause the device to run out of memory/the process or app to be killed?

@acostalima
Copy link
Author

acostalima commented Jan 20, 2021

Pubsub subscriptions in the HTTP client are long-lived requests that for all intents and purposes may never end.

If I receive an arbitrary number of pubsub messages, and we get incremental data updates to process those messages, can responseText be reset or will it grow over time and eventually cause the device to run out of memory/the process or app to be killed?

In case of the fetch implementation that ships with React Native I'd say that would be the case, yes, because it is implemented on top of XMLHttpRequest and response strings are buffered in memory until the request finishes. The alternative implementation I mentioned does not use XMLHttpRequest. Instead, it's built directly on top of React Native's Networking API which, AFAIK, does not hold on to previous responses.

@acostalima acostalima changed the title Enable text streaming support for React Native on pubsub.subscribe Enable text streaming support for React Native (iOS and Android) on pubsub.subscribe Feb 1, 2021
@BigLep BigLep added status/in-progress In progress status/inactive No significant work in the previous month and removed status/in-progress In progress status/inactive No significant work in the previous month labels Mar 22, 2021
@BigLep
Copy link
Contributor

BigLep commented Mar 22, 2021

@acostalima : is this still being worked on? If not, we'll plan on closing this PR. Thanks!

@acostalima
Copy link
Author

Hi @BigLep, on a second thought, I'll move this piece of logic to #3517 instead, which makes more sense in the scope of the work done over there as a whole. Feel free to close this. Thanks!

@BigLep BigLep closed this Mar 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants