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

Can't find variable: TextDecoder in React Native #201

Open
jasperjorna opened this issue Sep 27, 2022 · 2 comments
Open

Can't find variable: TextDecoder in React Native #201

jasperjorna opened this issue Sep 27, 2022 · 2 comments

Comments

@jasperjorna
Copy link

Hi,

I'm implementing centrifuge@^3.0.1 in a React Native (0.70, without Expo) project. The web sockets are working fine, but I would like to use the http_stream as fallback. Unfortunately it throws the following error when trying to use the http_stream transport mode. Is there some dependency missing?

ReferenceError: Can't find variable: TextDecoder
Error: ENOENT: no such file or directory, open 'FooProject/HttpStreamTransport@http:/localhost:8081/index.bundle?platform=ios&dev=true&minify=false&modulesOnly=false&runModule=true'
@FZambia
Copy link
Member

FZambia commented Sep 29, 2022

Hello, hmm - seems that TextDecoder is undefined in React Native (what I found - hapijs/joi#2141). Probably you can just use any polyfill that defines TextDecoder on global level to fix this like shown here?

If it works, seems we should document it, or add an explicit option like we have for readableStream for example.

And it seems that in any case we need to avoid throwing an error in constructor of http stream transport.

@itweb62
Copy link

itweb62 commented Mar 12, 2023

Hello , i have try http_stream with React native (iOS), it's a "no supported transport found" in this case. for webtransport too btw ^^'

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

No branches or pull requests

3 participants