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

ReactNative: Error: Creating URL objects is not supported yet. #547

Closed
soulfly opened this issue Jul 16, 2018 · 3 comments
Closed

ReactNative: Error: Creating URL objects is not supported yet. #547

soulfly opened this issue Jul 16, 2018 · 3 comments

Comments

@soulfly
Copy link

soulfly commented Jul 16, 2018

This example

client.start('ws://localhost:5280/xmpp-websocket')

not working under ReactNative, I'm getting the following error:

16:25:17: [Unhandled promise rejection: Error: Creating URL objects is not supported yet.]
- node_modules/react-native/Libraries/Blob/URL.js:53:20 in URL
* xmpp.js/packages/connection/index.js:51:22 in getDomain
* xmpp.js/packages/connection/index.js:228:33 in start$
- node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:296:30 in invoke
- node_modules/regenerator-runtime/runtime.js:62:44 in tryCatch
- node_modules/regenerator-runtime/runtime.js:152:28 in invoke
- node_modules/regenerator-runtime/runtime.js:195:17 in <unknown>
- node_modules/promise/setimmediate/core.js:45:7 in tryCallTwo
- node_modules/promise/setimmediate/core.js:200:23 in doResolve
- node_modules/promise/setimmediate/core.js:66:12 in Promise
- node_modules/regenerator-runtime/runtime.js:194:27 in callInvokeWithMethodAndArg
- node_modules/regenerator-runtime/runtime.js:217:12 in enqueue
- node_modules/regenerator-runtime/runtime.js:241:8 in async

I use the latest master branch

What we need to do is to specify a domain manually, like this:

var options =  {
  "domain": "some.chat.server.com",
  "uri": "ws://some.chat.server.com:5280/xmpp-websocket",
}
client.start(options)

As I understand, it can't be fixed now because of lack of RN support facebook/react-native#16434,
could you please update documentation with this thing?

@sonnyp
Copy link
Member

sonnyp commented Jul 24, 2018

interesting, so NativeScript uses React Native?

It can be fixed by requiring some polyfill or url instead of assuming global URL is defined. Not sure yet what's the best approach. Maybe document you need a polyfill if you environment doesn't support that feature or provide it with xmpp.js ?

@soulfly soulfly changed the title NativeScript: Error: Creating URL objects is not supported yet. ReactNative: Error: Creating URL objects is not supported yet. Jul 24, 2018
@soulfly
Copy link
Author

soulfly commented Jul 24, 2018

Sorry, my mistake, it's about ReactNative..

@soulfly soulfly closed this as completed Jul 25, 2018
@soulfly soulfly reopened this Jul 25, 2018
@sonnyp
Copy link
Member

sonnyp commented Oct 21, 2018

@sonnyp sonnyp closed this as completed Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants