Skip to content

socket option not working properly #690

Closed
tobybellwood/govstrap
#4

Description

@diagramatics

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.

Activity

  1. diagramatics commented on Jun 26, 2015

    @diagramatics
    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?

  2. shakyShane commented on Jun 26, 2015

    @shakyShane
    Contributor

    Confirmed this is not working correctly.

    We'll look at this asap.

  3. diagramatics commented on Jun 26, 2015

    @diagramatics
    Author

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

  4. changed the title [-]Socket.io polling URL based on where loaded JS relative path?[/-] [+]socket option not working properly[/+] on Jun 26, 2015
  5. added a commit that references this issue on Jun 27, 2015
    5157432
  6. shakyShane commented on Jun 28, 2015

    @shakyShane
    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"
    }
  7. diagramatics commented on Jun 28, 2015

    @diagramatics
    Author

    Yep, confirmed working. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions