GithubHelp home page GithubHelp logo

Comments (3)

tlaverdure avatar tlaverdure commented on July 20, 2024

@jonnywilliamson Does this help?

#14

from laravel-echo-server.

jonnywilliamson avatar jonnywilliamson commented on July 20, 2024

No. This is still plaguing me and I cannot find a reason.

I can get receive ALL broadcasts sent to the page, as long as I open the page and wait exactly 2 mins for something to timeout. It's crazy, I don't even know where to debug.

I ran a test. I open my webpage and have 3 listeners set up.
1 for public broadcast (no auth needed)
1 for private broadcast (auth needed)
1 for presence channel (auth needed).

I can see that as soon as I open my page, an ajax/socket.io request is instantly sent to my authHost (http://new.wn.dev) with all the correct data. However it never gets to the laravel app....it seems to timeout exactly 2 mins later.

In another window I fire off 3 events, 1 public, 1 private and 1 presence channel. The public one gets received (console log) instantly. The other 2 never arrive.

As soon as 2 mins is up and I reload page 2 to send the 3 events, all 3 get logged immediately!

Any thoughts gladly received!

from laravel-echo-server.

jonnywilliamson avatar jonnywilliamson commented on July 20, 2024

I've never spent so much time on a bug before - coming up on 3 weeks now. But I finally have an answer to this.

And of course it's incredibly simple and complex all at the same time.

After hours and hours of testing code and debugging variables, I finally noticed that one of my sites was resolving to 127.0.53.53 and not 127.0.0.1 as would be the norm on vagrant.

This stood out like a sore thumb and I went googling.

I finally came across a few threads and it all came together.

My websites all use .dev as the domain TLD and I've been using that for quite a while without ever having an issue before. However, it appears google is in the process of being the owner of the .dev domain and in doing so a name collision occurs when you try and use it for your own projects in certain circumstances and software versions.

Here's more info : https://www.icann.org/resources/pages/name-collision-2013-12-06-en#127.0.53.53

So what was happening was that node was trying to resolve my domain of new.wn.dev and was being directed to 127.0.53.53 instead of 127.0.0.1

For whatever reason with software versions installed and Ubuntu versions etc, this then caused a timeout for exactly 120 secs before everything started to work. (May also be related to this http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout)

The Fix

So simple. Stop using ANY TLD that is in the process of being setup/bought (eg .dev) and use one that has been designed specifically not to be used in the future. eg .test

More suggestions here: https://iyware.com/dont-use-dev-for-development/

As soon as I changed my developement domains to .test everything just clicked into place.

Public, private and presence channels all work now instantly without any timeouts etc.

And finally I can sleep without having this at the back of my mind!

For the record, here's what my laravel-echo-server.json file looks like.

{
    "appKey": "k7mo168sssssssssssssssssssssss6qtfh",
    "authEndpoint": "/broadcasting/auth",
    "authHost": "http://new.wn.test",
    "database": "redis",
    "databaseConfig": {
        "redis": {},
        "sqlite": {
            "databasePath": "/database/laravel-echo-server.sqlite"
        }
    },
    "devMode": false,
    "host": "localhost",
    "port": "6001",
    "protocol": "http",
    "referrers": [],
    "sslCertPath": "",
    "sslKeyPath": "",
    "verifyAuthPath": true,
    "verifyAuthServer": false
}

I hope this helps someone.

from laravel-echo-server.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.