diff --git a/src/internal/sio_client_impl.cpp b/src/internal/sio_client_impl.cpp index efda7f54..02cceada 100644 --- a/src/internal/sio_client_impl.cpp +++ b/src/internal/sio_client_impl.cpp @@ -557,6 +557,19 @@ namespace sio { case packet::frame_message: { + // Special event for sid sync + if (p.get_type() == packet::type_connect) { + auto message = p.get_message(); + if (message && message->get_flag() == message::flag_object) + { + const object_message* obj_ptr = static_cast(message.get()); + const std::map* values = &(obj_ptr->get_map()); + auto it = values->find("sid"); + if (it != values->end()) { + m_sid = std::static_pointer_cast(it->second)->get_string(); + } + } + } socket::ptr so_ptr = get_socket_locked(p.get_nsp()); if(so_ptr)so_ptr->on_message_packet(p); break;