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

Importing non-existant xmlhttprequest-ssl #543

Closed
1 task done
rithvikvibhu opened this issue Feb 27, 2017 · 5 comments
Closed
1 task done

Importing non-existant xmlhttprequest-ssl #543

rithvikvibhu opened this issue Feb 27, 2017 · 5 comments

Comments

@rithvikvibhu
Copy link

rithvikvibhu commented Feb 27, 2017

You want to:

  • report a bug

Current behaviour

Fails importing xmlhttprequest-ssl.js as it doesn't exist.

Steps to reproduce (if the current behaviour is a bug)

It's on the master branch.

Expected behaviour

The file should exist.

Setup

  • OS: Windows / Linux
  • browser:
  • engine.io version: latest master branch

Other information (e.g. stacktraces, related issues, suggestions how to fix)

https://github.com/socketio/engine.io-client/blob/master/lib/transports/index.js#L5
https://github.com/socketio/engine.io-client/blob/master/lib/transports/polling-xhr.js#L5
https://github.com/socketio/engine.io-client/blob/master/lib/transports/polling.js#L23
All 3 files require xmlhttprequest-ssl.js which doesn't exist. Changing them to ../xmlhttprequest works. I guess the ssl file is under development. This is a temporary fix.

@ramsestom
Copy link

This issue still exists in the current release. So I don't know why it has been closed...

@darrachequesne
Copy link
Member

@ramsestom could you please provide more details? xmlhttprequest-ssl is listed as dependency here and the browser should use ./lib/xmlhttprequest.js, defined there. Am I missing something?

@ramsestom
Copy link

I do not use engine.io-client in a browser (I use it in react-native) so this is probably not considered. Anyway, for me the correct file is in \node_modules\xmlhttprequest-ssl\lib\XMLHttpRequest.js and not directly in lib\XMLHttpRequest.js ...
So I don't know how you are supposed to make a requiere call of a dependency class but defining a static path (like lib/XMLHttpRequest.js ) is probably not the good way to do it....

@darrachequesne
Copy link
Member

darrachequesne commented May 22, 2017

@ramsestom I think you are misunderstanding:

xmlhttprequest-ssl is listed as dependency here: https://github.com/socketio/engine.io-client/blob/3.1.1/package.json#L36

So a node.js client would use the xmlhttprequest-ssl package, which emulates the XMLHttpRequest object from the browser.

the browser should use ./lib/xmlhttprequest.js, defined there: https://github.com/socketio/engine.io-client/blob/3.1.1/package.json#L72

The browser field (spec) describes which files are to be used in the browser (client-side). Here, instead of using the xmlhttprequest-ssl, it points towards the file https://github.com/socketio/engine.io-client/blob/master/lib/xmlhttprequest.js.

So I still think the issue is in react-native (and that may be related: facebook/react-native#9854)

@ramsestom
Copy link

OK. I removed the The browser field from the package.json package and the react-narive packager is now able to correctly find the ssl-xmlhttprequest package and class. This now fail because XMLLHttpRequest.js from ssl-xmlhttprequest is using core node modules (like fs) that react-native doesn't have. So, for now, I will stick to using the xmlhttprequest class embeded into the engine.io source (and completely remove the ssl-xmlhttprequest dependency)

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

No branches or pull requests

3 participants