Skip to content

Commit

Permalink
fix console demo compile issue in VS2012SP4
Browse files Browse the repository at this point in the history
  • Loading branch information
melode11 committed May 6, 2015
1 parent 8ea0696 commit 443a59a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions examples/Console/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <mutex>
#include <condition_variable>
#include <string>

#ifdef WIN32
#define HIGHLIGHT(__O__) std::cout<<__O__<<std::endl
#define EM(__O__) std::cout<<__O__<<std::endl
Expand Down Expand Up @@ -72,7 +71,7 @@ socket::ptr current_socket;

void bind_events(socket::ptr &socket)
{
current_socket->on("new message", [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
current_socket->on("new message",(sio::socket::event_listener_aux) [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
{
_lock.lock();
string user = data->get_map()["username"]->get_string();
Expand All @@ -81,7 +80,7 @@ void bind_events(socket::ptr &socket)
_lock.unlock();
});

current_socket->on("user joined", [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
current_socket->on("user joined", (sio::socket::event_listener_aux)[&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
{
_lock.lock();
string user = data->get_map()["username"]->get_string();
Expand All @@ -92,7 +91,7 @@ void bind_events(socket::ptr &socket)
HIGHLIGHT(user<<" joined"<<"\nthere"<<(plural?" are ":"'s ")<< participants<<(plural?" participants":" participant"));
_lock.unlock();
});
current_socket->on("user left", [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
current_socket->on("user left",(sio::socket::event_listener_aux) [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp)
{
_lock.lock();
string user = data->get_map()["username"]->get_string();
Expand All @@ -108,7 +107,7 @@ MAIN_FUNC

sio::client h;
connection_listener l(h);
current_socket = h.socket();

h.set_open_listener(std::bind(&connection_listener::on_connected, &l));
h.set_close_listener(std::bind(&connection_listener::on_close, &l,std::placeholders::_1));
h.set_fail_listener(std::bind(&connection_listener::on_fail, &l));
Expand All @@ -119,14 +118,15 @@ MAIN_FUNC
_cond.wait(_lock);
}
_lock.unlock();
current_socket = h.socket();
Login:
string nickname;
while (nickname.length() == 0) {
HIGHLIGHT("Type your nickname:");

getline(cin, nickname);
}
current_socket->on("login", [&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp){
current_socket->on("login", (sio::socket::event_listener_aux)[&](string const& name, message::ptr const& data, bool isAck,message::ptr &ack_resp){
_lock.lock();
participants = data->get_map()["numUsers"]->get_int();
bool plural = participants !=1;
Expand Down

0 comments on commit 443a59a

Please sign in to comment.