From f0204393e29fe6286a21b333fe1891a017c0d700 Mon Sep 17 00:00:00 2001 From: cqm Date: Tue, 3 Aug 2021 14:33:32 +0800 Subject: [PATCH] bugfix: has two connect on connection callback io.on('connection', (socket) => { let addedUser = false; console.log("new connection"); // when the client emits 'new message', this listens and executes socket.on('new message', (data) => { // we tell the client to execute 'new message' socket.broadcast.emit('new message', { username: socket.username, message: data }); }); ... --- src/sio_socket.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sio_socket.cpp b/src/sio_socket.cpp index e15ba83b..59bad97e 100644 --- a/src/sio_socket.cpp +++ b/src/sio_socket.cpp @@ -269,6 +269,7 @@ namespace sio void socket::impl::send_connect() { NULL_GUARD(m_client); + if (m_nsp == "/") return; packet p(packet::type_connect,m_nsp); m_client->send(p); m_connection_timer.reset(new asio::steady_timer(m_client->get_io_service()));