@@ -131,7 +131,7 @@ namespace sio
131131
132132 void close ();
133133
134- void emit (std::string const & name, message::list const & msglist, std::function<void (message::ptr const &)> const & ack);
134+ void emit (std::string const & name, message::list const & msglist, std::function<void (message::list const &)> const & ack);
135135
136136 std::string const & get_namespace () const {return m_nsp;}
137137
@@ -150,7 +150,7 @@ namespace sio
150150
151151 // Message Parsing callbacks.
152152 void on_socketio_event (const std::string& nsp, int msgId,const std::string& name, message::list&& message);
153- void on_socketio_ack (int msgId, message::ptr const & message);
153+ void on_socketio_ack (int msgId, message::list const & message);
154154 void on_socketio_error (message::ptr const & err_message);
155155
156156 event_listener get_bind_listener_locked (string const & event);
@@ -172,7 +172,7 @@ namespace sio
172172 bool m_connected;
173173 std::string m_nsp;
174174
175- std::map<unsigned int , std::function<void (message::ptr const &)> > m_acks;
175+ std::map<unsigned int , std::function<void (message::list const &)> > m_acks;
176176
177177 std::map<std::string, event_listener> m_event_binding;
178178
@@ -243,7 +243,7 @@ namespace sio
243243
244244 unsigned int socket::impl::s_global_event_id = 1 ;
245245
246- void socket::impl::emit (std::string const & name, message::list const & msglist, std::function<void (message::ptr const &)> const & ack)
246+ void socket::impl::emit (std::string const & name, message::list const & msglist, std::function<void (message::list const &)> const & ack)
247247 {
248248 NULL_GUARD (m_client);
249249 message::ptr msg_ptr = msglist.to_array_message (name);
@@ -398,19 +398,13 @@ namespace sio
398398 const message::ptr ptr = p.get_message ();
399399 if (ptr->get_flag () == message::flag_array)
400400 {
401- const array_message* array_ptr = static_cast <const array_message*>(ptr.get ());
402- if (array_ptr->get_vector ().size () >= 1 &&array_ptr->get_vector ()[0 ]->get_flag () == message::flag_string)
403- {
404- message::ptr value_ptr;
405- if (array_ptr->get_vector ().size ()>1 )
406- {
407- value_ptr = array_ptr->get_vector ()[1 ];
408- }
409- this ->on_socketio_ack (p.get_pack_id (), value_ptr);
410- break ;
411- }
401+ message::list msglist (ptr->get_vector ());
402+ this ->on_socketio_ack (p.get_pack_id (),msglist);
412403 }
413- this ->on_socketio_ack (p.get_pack_id (),ptr);
404+ else
405+ {
406+ this ->on_socketio_ack (p.get_pack_id (),message::list (ptr));
407+ }
414408 break ;
415409 }
416410 // Error
@@ -445,9 +439,9 @@ namespace sio
445439 send_packet (p);
446440 }
447441
448- void socket::impl::on_socketio_ack (int msgId, message::ptr const & message)
442+ void socket::impl::on_socketio_ack (int msgId, message::list const & message)
449443 {
450- std::function<void (message::ptr const &)> l;
444+ std::function<void (message::list const &)> l;
451445 {
452446 std::lock_guard<std::mutex> guard (m_event_mutex);
453447 auto it = m_acks.find (msgId);
@@ -551,7 +545,7 @@ namespace sio
551545 m_impl->off_error ();
552546 }
553547
554- void socket::emit (std::string const & name, message::list const & msglist, std::function<void (message::ptr const &)> const & ack)
548+ void socket::emit (std::string const & name, message::list const & msglist, std::function<void (message::list const &)> const & ack)
555549 {
556550 m_impl->emit (name, msglist,ack);
557551 }
0 commit comments