Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Silence net::ERR_CONNECTION_REFUSED

Connecting to a non-existent web socket server results in loud errors being logged to the console, usually to the tune of ... net::ERR_CONNECTION_REFUSED.

Anyone have an idea for a hackaround to silence this output? XMLHttpRequest won't work since it yields the same verbose error output if the server is not reachable.

The goal here is to test if the server is available, if it is then connect to it, otherwise use a fallback, and to do this without spamming the console with error output.

like image 711
Casper Beyer Avatar asked Mar 25 '17 03:03

Casper Beyer


People also ask

Why am I getting Err_connection_refused?

Reasons of ERR_CONNECTION_REFUSED error: Webserver can reject the IP address attached with proxy server, and hence display the browsing error. You have forgotten to remove the unavailable proxy server from internet settings. Incorrect proxy configuration.


1 Answers

Chrome itself is emitting these messages, and there is no way to block them. This is a function of how chrome was built; whenever a ResourceFetcher object attempts to fetch a resource, its response is passed back to its context, and if there's an error, the browser prints it to the console - see here.

Similar question can be found here.

If you'd like, you can use a chrome console filter as this question discusses to block these errors in your console, but there is no way to programmatically block the messages.

like image 138
joepin Avatar answered Oct 02 '22 11:10

joepin