V
V
Vitaly2018-01-25 14:03:31
Angular
Vitaly, 2018-01-25 14:03:31

How to handle net::ERR_CONNECTION_REFUSED in Socket.IO?

When the connection is lost, the browser starts typing GET request error messages to the console. I need to process this case, but after trying different handlers it turns out that they work out after this error message. How it's done?

this.socket = SocketIO(url);

    /*
    connect_error
    reconnect_error
    reconnect_attempt
    reconnecting
    reconnect
    */
    this.socket.on('reconnect', () => console.log('reconnect'));
    this.socket.on('reconnect_attempt', () => console.log('reconnect_attempt'));
    this.socket.on('reconnecting', () => console.log('reconnecting'));
    this.socket.on('reconnect_error', () => console.log('reconnect_error'));
    this.socket.on('connect_error', () => console.log('connect_error'));

    this.socket.on('error', () => console.log('error'));
    this.socket.on('connect_timeout', () => console.log('connect_timeout'));
    this.socket.on('reconnect_failed', () => console.log('reconnect_failed'));

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
davidnum95, 2018-01-25
@davidnum95

No, this error does not apply to socket.io. poke

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question