Closed iamchathu closed 5 years ago
Hi,
Thanks for reporting. Could you please try the following?
debug: true
to enable RWS debug messagesHopefully we can get some more information about this issue
Hi,
debug: true
in optionsStill, the problem exists. My WebSocket server receives the connection.
When I enable Debug JS remotely it works.
Currently, the only warning I have in the app is
Possible Unhandled Promise Rejection (id: 0): TypeError: undefined is not an object( evaluating '_d[0]')
_addListeners@http://localhost:8081/ ...
I tried with WebSocket and I works without issues.
Hi @iamchathu, same here when running on android, I'm using "reconnecting-websocket" version "4.1.6".
Here is the stacktrace, this code is generated from rollup and does not exits in original source.
[Unhandled promise rejection: TypeError: undefined is not an object (evaluating '_d[0]')]
- node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:561:56 in _addListeners
- node_modules/reconnecting-websocket/dist/reconnecting-websocket-cjs.js:447:12 in <unknown>
- ... 12 more stack frames from framework internals
Original code:
Generated code from rollup:
The interesting thing is if I enable the remote debugging the code works as expected without issues, but without debugging enabled the code is unable to resolve __read(_c.value, 2)
statement.
I'm running react-native in expo environment using the following versions:
I try to keep looking if I found something else, but once again I think the problem is the Rollup module bundler.
Possibly this routine _removeListeners
from source has the same problem too.
Latest release (v4.1.7) includes a simpler _addListeners
function (it was previously iterating a Map using for..of). Hopefully with this version the compiled code should be easier to follow.
Please, let me know if you try it
Great @pladaria,
im digging into the original cause of the issue and problem is related with Symbol
and probably it fails in spread method of cjs
file when debug
option is enable.
https://github.com/facebook/react-native/issues/4676
Symbol is not defined on android, one alternative is toimport 'core-js/es6/symbol'
polyfill on android.
btw you release the version v4.1.7 in NPM? or i try directly with the source code?
thanks !!
@outaTiME just published!
@pladaria, yup last version works great without errors, but _debug
method still using __spread
internal which references to Symbol
you need to be careful.
btw, i can confirm if i do the following imports the version 4.1.6 works as expected without issues (if you want to keep using for...of Map).
import 'core-js/es6/map';
import 'core-js/es6/symbol';
import 'core-js/fn/symbol/iterator';
Thanks !!!
@pladaria 4.1.7 fix this issue. Thank you.
@outaTiME Off topic. Can I know how you got the stacktrace?
@outaTiME thanks for the tip but I prefer to keep the library light and dependency free. I've also replaced spread operator usage for apply (v4.1.8)
Thank you all for reporting and investigating this issue!
Great @pladaria, thanks once for your time the v4.1.8 version works great without issues 👍 👍
@iamchathu The stacktrace cames from react native console not from application UI (im using Expo but it works in the same way as react native)
The server gets connection request but doesn't work after that and doesn't connect to the server. But when I turn on remote JS debugging it works perfectly.
"reconnecting-websocket": "^4.1.5"
Device Android 5.1.1