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

Not working with node-webkit #216

Closed
goldfire opened this issue Dec 2, 2014 · 9 comments
Closed

Not working with node-webkit #216

goldfire opened this issue Dec 2, 2014 · 9 comments

Comments

@goldfire
Copy link

goldfire commented Dec 2, 2014

Testing on node-webkit 0.10.x and 0.11.x, sock.js 1.0 fails to connect. However, reverting to 0.3.4 works perfectly. I've yet to figure out what might be causing this, but thought someone else might have run into this as well.

@brycekahle
Copy link
Contributor

More details would be appreciated. I haven't done any testing with node-webkit, but I'm guessing it might set the Origin to something tricky.

@darshan-rambhia
Copy link

Is there any update on the Issue?

@brycekahle
Copy link
Contributor

@bytekoders I'm waiting for more information from @goldfire. If you anyinformation, that would be a lot of help. I need way more detail before I can go about confirming the issue.

@brycekahle
Copy link
Contributor

Closing due to insufficient information

@hgwood
Copy link

hgwood commented Feb 18, 2016

I'm running into this issue and investigating it. The problem arises because of browserify expecting either global or window to be defined, but not both like in node-webkit.

For example:

module.exports = global.WebSocket || global.MozWebSocket;

In SockJS' browser build, browserify replaces global by the expression typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {} (see here). In a browser, this expression returnswindow. In node-webkit, global is defined and gets picked up, but it does not have a property WebSocket. Therefore, "All transports failed".

So this is effectively a problem between browserify and node-webkit. I'm still looking for the right way to fix, in particular if SockJS can do something about it or if the fix should be on the consumer side.

Browserify issue: browserify/browserify#1189
PR fixing said issue: browserify/insert-module-globals#48

Other possibly related issues: browserify/browserify#481, browserify/browserify#1025, browserify/browserify#834.

@hgwood
Copy link

hgwood commented Feb 18, 2016

Workaround: Object.setPrototypeOf(global, window).

@brycekahle
Copy link
Contributor

It appears that browserify can fix this without needing SockJS to do anything specific.

@hgwood
Copy link

hgwood commented Feb 27, 2016

Yes, I agree.

@Slayer95
Copy link

This is fixed for me with nw.js 0.13-rc-2

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

5 participants