-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix(react-native): error Cannot create URL for blob #1840
fix(react-native): error Cannot create URL for blob #1840
Conversation
@MaximoLiberata Please fix lint issues: |
Thank, I made the change at last commit 2fa569b |
Hey @MaximoLiberata still to be added at start of the program, after the recent release 5.5.2, Thanks |
Hey @abdelhameedhamdy, Yes, it's still necessary add that line at start of the program, the library doesn't affect the global environment of the React Native APP, also I couldn't find what library/package is using process.nextTick . I gonna upload a example of my RN implementation where you and other can see it and test it. |
I think the package is |
I will see it and I will return you a feedback, while please check the implementation that I did in React Native (React Native MQTT.js Implementation), test it and tell me if worked for you, also to continue the discussion we can go to #1841 |
Error: Cannot create URL for blob!
located: src/lib/client.ts
method: _setupPingTimer
class: PingTimer
init: getTimer(variant) = getTimer('auto')
Description:
The error is caused for the library
worker-timers
when the classPingTimer
callgetTimer('auto')
method. This methodgetTimer
doesn't recognize it's executed in ReactNative (RN), it know it's executed in a browser, but RN implements its own timers as:setTimeOut
,setInterval
, etc., when is called the methodworkerTimer
insteadnativeTimer
the libraryworker-timers
that implementBlob
to store data or whatever it does, throw the next error: [Error: cannot create URL for blob!],Blob
it isn't supported by RN.Fix:
To support ReactNative (RN) it's necessary install 2 package additionals to RN projects:
Also include the next code at beginning of the program:
process.nextTick = (callback) => { setTimeout(callback, 0) }
Conclusion
I have the commit of the fix of this bug, please @robertsLando allow me create a PR and show you my solution.
I will attach my mqtt client connection and the files I changed in this package to fix the bug:
mqtt_client_example.txt
is-browser.txt
get-timer.txt
shared.txt
BufferedDuplex.txt