@@ -131,7 +131,7 @@ namespace sio
131
131
132
132
void close ();
133
133
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);
135
135
136
136
std::string const & get_namespace () const {return m_nsp;}
137
137
@@ -150,7 +150,7 @@ namespace sio
150
150
151
151
// Message Parsing callbacks.
152
152
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);
154
154
void on_socketio_error (message::ptr const & err_message);
155
155
156
156
event_listener get_bind_listener_locked (string const & event);
@@ -172,7 +172,7 @@ namespace sio
172
172
bool m_connected;
173
173
std::string m_nsp;
174
174
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;
176
176
177
177
std::map<std::string, event_listener> m_event_binding;
178
178
@@ -243,7 +243,7 @@ namespace sio
243
243
244
244
unsigned int socket::impl::s_global_event_id = 1 ;
245
245
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)
247
247
{
248
248
NULL_GUARD (m_client);
249
249
message::ptr msg_ptr = msglist.to_array_message (name);
@@ -398,19 +398,13 @@ namespace sio
398
398
const message::ptr ptr = p.get_message ();
399
399
if (ptr->get_flag () == message::flag_array)
400
400
{
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);
412
403
}
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
+ }
414
408
break ;
415
409
}
416
410
// Error
@@ -445,9 +439,9 @@ namespace sio
445
439
send_packet (p);
446
440
}
447
441
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)
449
443
{
450
- std::function<void (message::ptr const &)> l;
444
+ std::function<void (message::list const &)> l;
451
445
{
452
446
std::lock_guard<std::mutex> guard (m_event_mutex);
453
447
auto it = m_acks.find (msgId);
@@ -551,7 +545,7 @@ namespace sio
551
545
m_impl->off_error ();
552
546
}
553
547
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)
555
549
{
556
550
m_impl->emit (name, msglist,ack);
557
551
}
0 commit comments