From d324e7f396a444ddd556c3d70a85a28eefb1e02b Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Tue, 27 Apr 2021 00:08:16 +0200 Subject: [PATCH] fix: emit a CONNECT_ERROR event upon connection failure See also: https://github.com/socketio/socket.io-client/commit/53c73749a829b2c98d9a5e45c48f0ae5a22c056c --- src/main/java/io/socket/client/Socket.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/socket/client/Socket.java b/src/main/java/io/socket/client/Socket.java index 70e35ddd..05feff39 100644 --- a/src/main/java/io/socket/client/Socket.java +++ b/src/main/java/io/socket/client/Socket.java @@ -91,7 +91,9 @@ public void call(Object... args) { add(On.on(io, Manager.EVENT_ERROR, new Listener() { @Override public void call(Object... args) { - Socket.super.emit(EVENT_CONNECT_ERROR, args[0]); + if (!Socket.this.connected) { + Socket.super.emit(EVENT_CONNECT_ERROR, args[0]); + } } })); add(On.on(io, Manager.EVENT_CLOSE, new Listener() {