Closed johann1301s closed 3 years ago
I found that there are some errors that cant be handled by the client code; socket.io or pusher-js.
https://socket.io/docs/v3/logging-and-debugging/#Error-logs-in-the-browser-console
So maybe this is not an error, just messages that it cant connect to http(s) when it is already connected with ws(s).
The URL in the error is not a Pusher cluster URL, as you have identified. Based on your cluster selection the Pusher lib should be attempting to connect to wss://ws-eu.pusher.com.
I also note that the URL appears to mention socket.io. Looking at this bug in the socketio repo it seems the code throwing the error is not Pusher code.
However, as you have mentioned the ERR_CONNECTION_REFUSED message is being generated by Chrome so it is not something that can be caught in our library.
I keep seeing this error in the console in regular intervals:
GET http://localhost:4000/socket.io/?EIO=4&transport=polling&t=NegyEhg net::ERR_CONNECTION_REFUSED
I'm seeing it locally, when running on localhost:3000 using next, and also when its running on vercel.
I am assuming that this is the pusher-js client code that is having trouble connecting to the pusher cluster.
Here is my two next api endpoints:
And here is the client code:
Why is this error appearing? Why is the client pusher-js library calling localhost? Why port 4000? When I am running locally I am using port 3000, so i don't think it is connected to the origin host domain.
Maybe it is a webpack issue, or a cors issue?
Any ideas on what is going on here?