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

socket option not working properly #690

Closed
diagramatics opened this issue Jun 23, 2015 · 5 comments · May be fixed by tobybellwood/govstrap#4
Closed

socket option not working properly #690

diagramatics opened this issue Jun 23, 2015 · 5 comments · May be fixed by tobybellwood/govstrap#4
Labels

Comments

@diagramatics
Copy link

Hi. This is a complicated issue, hopefully I'll be able to explain it correctly.

So I want to use BrowserSync on a live website where I have no access to the code. I'm not using the proxy so I can still maintain the cookies needed for login and other kinds of things, so I managed to create a Chrome extension to append the needed script tag into the DOM and replacing the src to localhost instead of using .replace() with the hostname.

All goes well, script gets executed, but I noticed the GET requests to socket.io are using the hostname instead. Is there any way to override it somehow? I was expecting the requests to be based on the location where the initial .js file is at.

@diagramatics
Copy link
Author

So I narrowed the problem down and it seems the only way I can solve this is by changing the socket option. Tried following one of the examples in the docs, changing the namespace to localhost:3000 and the polling requests are definitely coming through.

The weird part though is that even though the requests have statuses of 200 (and 101 for the websocket) it doesn't seem to work after the namespace change. No notification of BrowserSync being connected, even after enabling debug logs. Seems like a duplicate of #621.

Help?

@shakyShane
Copy link
Contributor

Confirmed this is not working correctly.

We'll look at this asap.

@shakyShane shakyShane added the bug label Jun 26, 2015
@diagramatics
Copy link
Author

Ah, I guess a title change is in order. Thanks.

@diagramatics diagramatics changed the title Socket.io polling URL based on where loaded JS relative path? socket option not working properly Jun 26, 2015
@shakyShane shakyShane reopened this Jun 27, 2015
@shakyShane
Copy link
Contributor

Fixed in v2.7.13

The original implementation was completely broken (where setting the namespace allowed a url, doh!).

now, to achieve what you want, it's the domain property you want.

socket: {
    domain: "localhost:3000"
}

@diagramatics
Copy link
Author

Yep, confirmed working. Thanks!

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

Successfully merging a pull request may close this issue.

2 participants