{"action":"created","issue":{"url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/15","labels_url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/15/labels{/name}","comments_url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/15/comments","events_url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/15/events","html_url":"https://github.com/socketio/socket.io-client-cpp/issues/15","id":78718759,"number":15,"title":"Emit Binary conversion error while using std::make_shared<std::string>( Foo )","user":{"login":"mdeforge","id":3293541,"avatar_url":"https://avatars.githubusercontent.com/u/3293541?v=3","gravatar_id":"","url":"https://api.github.com/users/mdeforge","html_url":"https://github.com/mdeforge","followers_url":"https://api.github.com/users/mdeforge/followers","following_url":"https://api.github.com/users/mdeforge/following{/other_user}","gists_url":"https://api.github.com/users/mdeforge/gists{/gist_id}","starred_url":"https://api.github.com/users/mdeforge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdeforge/subscriptions","organizations_url":"https://api.github.com/users/mdeforge/orgs","repos_url":"https://api.github.com/users/mdeforge/repos","events_url":"https://api.github.com/users/mdeforge/events{/privacy}","received_events_url":"https://api.github.com/users/mdeforge/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-20T22:09:21Z","updated_at":"2015-05-22T05:32:30Z","closed_at":"2015-05-22T04:12:01Z","body":"This is almost verbatim from the README.\r\n\r\nchar buf[100];\r\ncurrent_socket->emit ( \"bintest\", std::make_shared<std::string>(&buf, 100) );\r\n\r\nI get: Error\t1\terror C2664: 'void sio::socket::emit(const std::string &,const sio::message::list &,const std::function<void (const sio::message::ptr &)> &)' : cannot convert argument 2 from 'std::shared_ptr<std::string>' to 'const sio::message::list &'\tC:\\Libraries\\socket.io-client-cpp\\examples\\Console\\main.cpp\t90 \r\n"},"comment":{"url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/comments/104515413","html_url":"https://github.com/socketio/socket.io-client-cpp/issues/15#issuecomment-104515413","issue_url":"https://api.github.com/repos/socketio/socket.io-client-cpp/issues/15","id":104515413,"user":{"login":"melode11","id":3647507,"avatar_url":"https://avatars.githubusercontent.com/u/3647507?v=3","gravatar_id":"","url":"https://api.github.com/users/melode11","html_url":"https://github.com/melode11","followers_url":"https://api.github.com/users/melode11/followers","following_url":"https://api.github.com/users/melode11/following{/other_user}","gists_url":"https://api.github.com/users/melode11/gists{/gist_id}","starred_url":"https://api.github.com/users/melode11/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/melode11/subscriptions","organizations_url":"https://api.github.com/users/melode11/orgs","repos_url":"https://api.github.com/users/melode11/repos","events_url":"https://api.github.com/users/melode11/events{/privacy}","received_events_url":"https://api.github.com/users/melode11/received_events","type":"User","site_admin":false},"created_at":"2015-05-22T05:32:30Z","updated_at":"2015-05-22T05:32:30Z","body":"Hi, if you're making `std::string` with code:\r\n```C++\r\nstd::string binary( \"teststring\" )\r\n```\r\nYou are actually making a common string with c string,which is actually an array of chars ending with 0 in memory:\r\n```\r\n['t','e','s','t','s','t','r','i','n','g',0]\r\n```\r\nThe `std::string` constructor will cut the string when it meets 0, so you get your \"teststring\" in `std::string`\r\n\r\nBut if you want to create real binary data without pass size like:\r\n```C++\r\n//real binary will be made up with values between 0-255 in any position.\r\n//this is just a example\r\nchar buf = {'a','b','c',0,'d','e','f'}; \r\nstd::string binary(buf)\r\n```\r\nthe `std::string` constructor also cut the string when it meets 0, you're end up with \"abc\" in this case,  to create `std::string` with content \"abc\\0def\" ,you have to pass the size 7.\r\n\r\n"}}