Skip to content

emit three values #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
kioqq opened this issue Apr 18, 2015 · 17 comments
Closed

emit three values #7

kioqq opened this issue Apr 18, 2015 · 17 comments

Comments

@kioqq
Copy link

kioqq commented Apr 18, 2015

Hello dudes!
How i can emit my data in this fomat
emit("event",string,string);

code on node.js:
socket.on('event', function(data1,data2){....});

help me pls ._.

@melode11
Copy link
Contributor

Array_message
---string_message1
---string_message2

@melode11
Copy link
Contributor

I found at this point we can not fullfill that style of variable argument list you posted.
Can you use array_message instead, and receive that array as the 1st argument in your message callback.
But I'm going to support the variable argument overload these days.

@kioqq
Copy link
Author

kioqq commented Apr 19, 2015

Thx man, i just make new emit method 💃 But ur solution works too ^_^

@melode11
Copy link
Contributor

I've added variable arguments support in latest release.
bc3d745

@melode11
Copy link
Contributor

message::list li(arg1);
li.push(arg2);
socket.emit("event",li);

@kioqq
Copy link
Author

kioqq commented Apr 21, 2015

@melode11 thx man ^_^

@kioqq
Copy link
Author

kioqq commented Apr 21, 2015

@melode11 i have one stupid question, all work in ur test project,but after import all in my main project,i have some errors with boost lib, and others can u make FAQ or just answer how import this lib in iOS project ._. It's rly help for me.

@kioqq
Copy link
Author

kioqq commented Apr 21, 2015

Undefined symbols for architecture x86_64:
  "boost::system::system_category()", referenced from:
      ___cxx_global_var_init6 in sio_client_impl.o
      boost::asio::error::get_system_category() in sio_client_impl.o
      boost::system::error_code::error_code() in sio_client_impl.o
      ___cxx_global_var_init6 in sio_client.o
      boost::asio::error::get_system_category() in sio_client.o
      ___cxx_global_var_init6 in sio_socket.o
      boost::asio::error::get_system_category() in sio_socket.o
      ...
  "boost::system::generic_category()", referenced from:
      ___cxx_global_var_init4 in sio_client_impl.o
      ___cxx_global_var_init5 in sio_client_impl.o
      ___cxx_global_var_init4 in sio_client.o
      ___cxx_global_var_init5 in sio_client.o
      ___cxx_global_var_init4 in sio_socket.o
      ___cxx_global_var_init5 in sio_socket.o
ld: symbol(s) not found for architecture x86_64

i have this warning now ._.
Following StackOverFlow, I add -lboost_system in my Xcode project, but it's don't works for me.

@melode11
Copy link
Contributor

did you build the boost and have the libboost_system.a

@melode11
Copy link
Contributor

You can follow my boost build instructions to got the static lib

@kioqq
Copy link
Author

kioqq commented Apr 21, 2015

@melode11 with static framework i have "EXC_BAD_ACCESS" in this method

void client::connect(const std::string& uri)
 {
    m_impl->connect(uri);
 }

@melode11
Copy link
Contributor

Weird.
What's your detailed info?

@gooderist
Copy link

Hello, thanks for the list example. How would I create an object message?
for example: { title: "my book", characters: ["sam", "bill", "tex"] }

@melode11
Copy link
Contributor

message::ptr m =object_message::create();
m->get_map()//put any child messages

@panhuachao
Copy link

@melode11 Can you write an example for puting any child messages?

@panhuachao
Copy link

message::ptr object_map_ptr=object_message::create(); std::map<std::string,message::ptr> maps=object_map_ptr->get_map(); maps.insert(pair<string,message::ptr>("systemid",string_message::create("123"))); maps.insert(pair<string,message::ptr>("groupid",string_message::create(""))); maps.insert(pair<string,message::ptr>("clientid",string_message::create("123"))); maps.insert(pair<string,message::ptr>("accesstoken",string_message::create(""))); maps.insert(pair<string,message::ptr>("time",string_message::create(""))); _io->socket()->emitmessage("login",object_map_ptr);
I do it like this, but server can not receive object message.

@liwuking
Copy link

@panhuachao Can you solve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants