C++11 implementation of Socket.IO client

Overview

Socket.IO C++ Client

Build Status

By virtue of being written in C++, this client works in several different platforms. The examples folder contains an iPhone, QT and Console example chat client! It depends on websocket++ and is inspired by socket.io-clientpp.

Clients with iPhone, QT, Console and web

Compatibility table

C++ Client version Socket.IO server version
2.x (2.x branch) 1.x / 2.x
3.x (master branch) 3.x

Features

  • 100% written in modern C++11
  • Binary support
  • Automatic JSON encoding
  • Multiplex support
  • Similar API to the Socket.IO JS client
  • Cross platform

Note: Only the WebSocket transport is currently implemented (no fallback to HTTP long-polling)

Installation alternatives

Quickstart

** Full overview of API can be seen here **

The APIs are similar to the JS client.

Connect to a server

sio::client h;
h.connect("http://127.0.0.1:3000");

Emit an event

// emit event name only:
h.socket()->emit("login");

// emit text
h.socket()->emit("add user", username);

// emit binary
char buf[100];
h.socket()->emit("add user", std::make_shared(buf,100));

// emit message object with lambda ack handler
h.socket()->emit("add user", string_message::create(username), [&](message::list const& msg) {
});

// emit multiple arguments
message::list li("sports");
li.push(string_message::create("economics"));
socket->emit("categories", li);

Items in message::list will be expanded in server side event callback function as function arguments.

Bind an event

Bind with function pointer
void OnMessage(sio::event &)
{

}
h.socket()->on("new message", &OnMessage);
Bind with lambda
h.socket()->on("login", [&](sio::event& ev)
{
    //handle login message
    //post to UI thread if any UI updating.
});
Bind with member function
class MessageHandler
{
public:
    void OnMessage(sio::event &);
};
MessageHandler mh;
h.socket()->on("new message",std::bind( &MessageHandler::OnMessage,&mh,std::placeholders::_1));

Using namespace

h.socket("/chat")->emit("add user", username);

** Full overview of API can be seen here **

License

MIT

Comments
  • emit three values

    emit three values

    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 ._.

    enhancement interface 
    opened by kioqq 17
  • Emit Binary conversion error while using std::make_shared<std::string>( Foo )

    Emit Binary conversion error while using std::make_shared( Foo )

    This is almost verbatim from the README.

    char buf[100]; current_socket->emit ( "bintest", std::make_sharedstd::string(&buf, 100) );

    I get: Error 1 error 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_ptrstd::string' to 'const sio::message::list &' C:\Libraries\socket.io-client-cpp\examples\Console\main.cpp 90

    opened by mdeforge 15
  • Build failing

    Build failing

    I'm getting a ton of errors saying

    overriding virtual function has less restrictive exception specification than base class virtual member function

    Using Visual Studio 17 on Windows 10

    opened by AshotN 13
  • build a sioclient lib with TLS

    build a sioclient lib with TLS

    my socket.io server use SSL , and I need build a socket.io cpp client to connect server with SSL.

    I try build sioclient_tls like this:

    cmake -DBOOST_INCLUDEDIR=/usr/local/Cellar/boost/1.58.0/include -DBOOST_LIBRARYDIR=/usr/local/Cellar/boost/1.58.0/lib -DBOOST_VER:STRING=1.58.0 -DTARGET=sioclient_tls
    // is work!!
    
    make -dSIO_TLS
    
    make install
    

    then , create two static lib ("libsioclient.a and libsioclient_tls.a") and “build” directory

    so ,I use build/lib/Release lib andbuild/include header file and libsioclient_tls.a lib to make my cpp-client project!

    but , can’t work , so many error in the logs , can’t build .

    so , I use libsoclient.a to replacelibsioclient_tls.a

    and compile is pass . but can’t connect the socket.io server with ssl

    [2015-09-09 11:20:53][connect] Successful connection
    
    [2015-09-09 11:20:53][error] handle_read_http_response error: websocketpp.transport:7 (End of File)
    

    P.S.

    when I use socket.io javascript client ,use https://xxxx to connect server is success.

    help wanted 
    opened by einsitang 11
  • Removed Boost dependency

    Removed Boost dependency

    • Added the standalone ASIO as a replacement for Boost ASIO
    • Added Catch++ as a replacement for Boost Test framework
    • Removed dependency on Boost DateTime and Boost Lexical Cast

    ** I have not removed Boost from examples due to lack of time!

    opened by 3p3r 10
  • Creating a socket.io CPP client no possible with SSL/TSL (SIO_TLS) enabled

    Creating a socket.io CPP client no possible with SSL/TSL (SIO_TLS) enabled

    I followed the basic instructions to build a CPP Client 'without cmake' (https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md#without-cmake) and then tried enable 'SSL/TSL' following the basic instructions found in 'sio_client_impl.cpp':

    #if SIO_TLS // If using Asio's SSL support, you will also need to add this #include. // Source: http://think-async.com/Asio/asio-1.10.6/doc/asio/using.html // #include <asio/ssl/impl/src.hpp> #endif

    Due to this instructions I also was asked to switch from 'ASIO_STANDALONE' to 'ASIO_SEPARATE_COMPILATION', which in turn forced me to include 'boost' and 'boost/asio' as well as 'OpenSSL' into my include path and to disable 'socket.io-client-cpp/lib/asio/asio/include' from the same.

    As it turned out, apparently the 'socket.io-client-cpp' package (version 0.8.2 ?), is not compliant with the most recent boost structure changes concerning the location of 'asio/error_code.hpp' which now seems to be located at 'boost/system'.

    Please advice where I can find correct instructions to enable SSL/TSL support, or otherwise, please let me know if the is any chance that this problem gets solved by the owner of this GitHub project.

    Thanks and best regards

    Ludwig

    Used include path: ../../Vendor/boost/1.78 ../../Vendor/boost/1.78/boost ../../Vendor/OpenSource/OpenSSL/1.1.1m/include ../socket.io-client-cpp/lib/rapidjson/include ../socket.io-client-cpp/lib/websocketpp xxxx_../socket.io-client-cpp/lib/asio/asio/include

    Used preprocessor settings: WIN32 _DEBUG _CONSOLE _BOOST_DATE_TIME_NO_LIB _BOOST_REGEX_NO_LIB ASIO_SEPARATE_COMPILATION xxxxx_ASIO_STANDALONE WEBSOCKETPP_CPP11_STL WEBSOCKETPP_CPP11_FUNCTIONAL SIO_TLS

    opened by LudwigBloder 9
  • How to emit a JSON object?

    How to emit a JSON object?

    Hello, I noticed that in \test\sio_test.cpp, nlohmann mentioned that JSON will not compile on Windows:

    ifndef _WIN32

    include "json.hpp" //nlohmann::json cannot build in MSVC

    endif

    Does it mean that I cann't emit a JSON object from Win32 client? Here is my object { name: 'Joe', age: 25, car: { photo: , year: 2005 } } If I can, could you give a simple example?

    Thanks a lot!

    opened by haitaoxin 8
  • Array acknowledge

    Array acknowledge

    If an ack is an array, socket.io-client only returns the second element of the ack (sio_socket.cpp: line 399-412). Is there any plan to add support for array ack?

    opened by jianjunz 8
  • get_double() asserting on valid input

    get_double() asserting on valid input

    Hello, I am seeing get_double() asserting on sio_message.h: 48 when I send in an object with either an integer or value like "5.0".

    I guess while I'm at it I'll also request that something be done to prevent the assert on get_int() when a double is provided, like rounding or truncation?

    opened by gooderist 8
  • Suitable OpenSSL version for SocketIO client

    Suitable OpenSSL version for SocketIO client

    Which version of OpenSSL is suitable for TLS client? I managed build it with boost 1.68.0 and OpenSSL 1.0.2g, but when I try to link client_tls lib, i am receiving a lot of errors:

    In function boost::asio::ssl::detail::openssl_init_base::instance()': [build] sio_client.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv[_ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv]+0xbd): undefined reference toSSL_library_init' [build] sio_client.cpp:(.text._ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv[_ZN5boost4asio3ssl6detail17openssl_init_base8instanceEv]+0xc2): undefined reference to `SSL_load_error_strings' [build] ................................ ...............and so on

    Build without TLS works well

    opened by rytisss 7
  • Unable to build project files

    Unable to build project files

    Hi, I am trying to install socket.io-client cpp but not able to build the project files generated by cmake for Visual studio 2010. I was following the steps from https://github.com/socketio/socket.io-client-cpp/blob/master/INSTALL.md At the bottom is the list of errors that popped up. Any help will be appreciated!

    1>------ Rebuild All started: Project: ZERO_CHECK, Configuration: Debug Win32 ------ 1> Checking Build System 1> CMake does not need to re-run because D:/Git/robogen/socket.io-client-cpp/CMakeFiles/generate.stamp is up-to-date. 2>------ Rebuild All started: Project: sioclient, Configuration: Debug Win32 ------ 3>------ Rebuild All started: Project: sioclient_tls, Configuration: Debug Win32 ------ 2> Building Custom Rule D:/Git/robogen/socket.io-client-cpp/CMakeLists.txt 2> CMake does not need to re-run because D:/Git/robogen/socket.io-client-cpp/CMakeFiles/generate.stamp is up-to-date. 3> Building Custom Rule D:/Git/robogen/socket.io-client-cpp/CMakeLists.txt 3> CMake does not need to re-run because D:/Git/robogen/socket.io-client-cpp/CMakeFiles/generate.stamp is up-to-date. 2> sio_client.cpp 3> sio_client.cpp 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(166): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(171): error C2065: '_v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(176): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(166): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(171): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(176): error C2065: '_v' : undeclared identifier 2>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 2> sio_socket.cpp 3>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 3> sio_socket.cpp 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(166): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(171): error C2065: '_v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(176): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(158): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(166): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(171): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\sio_message.h(176): error C2065: '_v' : undeclared identifier 2>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 2> sio_client_impl.cpp 3>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 3> sio_client_impl.cpp 2>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 2> sio_packet.cpp 3>D:\Git\robogen\socket.io-client-cpp\lib\websocketpp\websocketpp/common/thread.hpp(47): fatal error C1083: Cannot open include file: 'thread': No such file or directory 3> sio_packet.cpp 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(158): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(166): error C2065: 'v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(171): error C2065: '_v' : undeclared identifier 2>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(176): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C2433: 'sio::message::int64_t' : 'virtual' not permitted on data declarations 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(51): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(52): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(55): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C2146: syntax error : missing ';' before identifier '_v' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(156): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(158): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(164): error C2061: syntax error : identifier 'int64_t' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(169): error C2146: syntax error : missing ';' before identifier 'get_int' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(169): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(170): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(172): warning C4183: 'get_int': missing return type; assumed to be a member function returning 'int' 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(158): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(160): error C2614: 'sio::int_message' : illegal member initialization: '_v' is not a base or member 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(166): error C2065: 'v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(171): error C2065: '_v' : undeclared identifier 3>d:\git\robogen\socket.io-client-cpp\src\internal../sio_message.h(176): error C2065: '_v' : undeclared identifier 2>src\internal\sio_packet.cpp(142): error C2660: 'sio::int_message::create' : function does not take 1 arguments 3>src\internal\sio_packet.cpp(142): error C2660: 'sio::int_message::create' : function does not take 1 arguments 2> Generating Code... 3> Generating Code... 4>------ Rebuild All started: Project: ALL_BUILD, Configuration: Debug Win32 ------ 4> Building Custom Rule D:/Git/robogen/socket.io-client-cpp/CMakeLists.txt 4> CMake does not need to re-run because D:/Git/robogen/socket.io-client-cpp/CMakeFiles/generate.stamp is up-to-date. 5>------ Skipped Rebuild All: Project: INSTALL, Configuration: Debug Win32 ------ 5>Project not selected to build for this solution configuration ========== Rebuild All: 2 succeeded, 2 failed, 1 skipped ==========

    opened by rshankerganesh 7
  • Help please send ask

    Help please send ask

    Client:

        h.socket()->on("getGamesAndPlayers", sio::socket::event_listener_aux([&](string const& name, message::ptr const& data, bool isAck,message::list &ack_resp)
        {
            if (isAck) {
                ack_resp.push(string_message::create("economics"));
            }
        }));
    

    Server:

      client.on("getGamesAndPlayers", (from) => {
        server.to("Host Bots").emit("getGamesAndPlayers", from, (response) => {
          console.log("Answer: " + response); // "got it"
        });
      });
    

    Answer: Error: operation has timed out OR NULL

    opened by TemKaSD 0
  • Compile for Windows XP

    Compile for Windows XP

    For some reason, I have to make socketio work on Windows XP. Is there anyone knows how to build socketio with static library for Windows XP?

    Any help is appreciated.

    opened by zeze-zeze 1
  • SSL certificate ?

    SSL certificate ?

    Hello Is it possible to use SSL certificate ? Do you have some snippets code? my socketio server needs authenticated client and reject others

    Thanks !

    opened by zefaridator 0
  • __strlen_avx2 () crash  in openssl

    __strlen_avx2 () crash in openssl

    #0 __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65 #1 0x00007fcc8e85e276 in bio_puts () from /usr/local/lib/libcrypto.so.1.1 #2 0x000055c7034fd7e2 in BIO_pending () #3 0x000055c703b25d68 in asio::ssl::detail::engine::perform(int (asio::ssl::detail::engine::)(void, unsigned long), void*, unsigned long, std::error_code&, unsigned long*) () #4 0x000055c703b68842 in unsigned long asio::ssl::detail::io<asio::basic_stream_socketasio::ip::tcp, asio::ssl::detail::handshake_op>(asio::basic_stream_socketasio::ip::tcp&, asio::ssl::detail::stream_core&, asio::ssl::detail::handshake_op const&, std::error_code&) ()

    run on ubuntu-18.06 x86_64

    opened by nanguantong 0
  • build(deps): bump engine.io and socket.io in /test/echo_server

    build(deps): bump engine.io and socket.io in /test/echo_server

    Bumps engine.io to 4.1.2 and updates ancestor dependency socket.io. These dependencies need to be updated together.

    Updates engine.io from 4.0.6 to 4.1.2

    Release notes

    Sourced from engine.io's releases.

    4.1.2

    :warning: This release contains an important security fix :warning:

    A malicious client could send a specially crafted HTTP request, triggering an uncaught exception and killing the Node.js process:

    RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear at Receiver.getInfo (/.../node_modules/ws/lib/receiver.js:176:14) at Receiver.startLoop (/.../node_modules/ws/lib/receiver.js:136:22) at Receiver._write (/.../node_modules/ws/lib/receiver.js:83:10) at writeOrBuffer (internal/streams/writable.js:358:12)

    This bug was introduced by this commit, included in [email protected], so previous releases are not impacted.

    Thanks to Marcus Wejderot from Mevisio for the responsible disclosure.

    Bug Fixes

    • properly handle invalid data sent by a malicious websocket client (a70800d)

    Links

    4.1.1

    Bug Fixes

    • do not reset the ping timer after upgrade (ff2b8ab)

    Links

    4.1.0

    Features

    • add support for v3.x clients (663d326)

    Links

    Changelog

    Sourced from engine.io's changelog.

    4.1.2 (2022-01-11)

    :warning: This release contains an important security fix :warning:

    A malicious client could send a specially crafted HTTP request, triggering an uncaught exception and killing the Node.js process:

    RangeError: Invalid WebSocket frame: RSV2 and RSV3 must be clear at Receiver.getInfo (/.../node_modules/ws/lib/receiver.js:176:14) at Receiver.startLoop (/.../node_modules/ws/lib/receiver.js:136:22) at Receiver._write (/.../node_modules/ws/lib/receiver.js:83:10) at writeOrBuffer (internal/streams/writable.js:358:12)

    This bug was introduced by this commit, included in [email protected], so previous releases are not impacted.

    Thanks to Marcus Wejderot from Mevisio for the responsible disclosure.

    Bug Fixes

    • properly handle invalid data sent by a malicious websocket client (a70800d)

    4.1.1 (2021-02-02)

    Bug Fixes

    4.1.0 (2021-01-14)

    Features

    • add support for v3.x clients (663d326)
    Commits
    • c6315af chore(release): 4.1.2
    • a70800d fix: properly handle invalid data sent by a malicious websocket client
    • 9534355 chore(release): 4.1.1
    • ae840fa chore: point towards the master branch for the CI badge
    • ff2b8ab fix: do not reset the ping timer after upgrade
    • e5b307c chore(release): 4.1.0
    • 663d326 feat: add support for v3.x clients
    • See full diff in compare view

    Updates socket.io from 3.0.5 to 3.1.2

    Release notes

    Sourced from socket.io's releases.

    3.1.2

    Bug Fixes

    • ignore packets received after disconnection (494c64e)

    Links:

    3.1.1

    Bug Fixes

    • properly parse the CONNECT packet in v2 compatibility mode (6f4bd7f)
    • typings: add return types and general-case overload signatures (#3776) (9e8f288)
    • typings: update the types of "query", "auth" and "headers" (4f2e9a7)

    Links:

    3.1.0

    In order to ease the migration to Socket.IO v3, the v3 server is now able to communicate with v2 clients:

    const io = require("socket.io")({
      allowEIO3: true // false by default
    });
    

    Note: the allowEIO3 refers to the version 3 of the Engine.IO protocol which is used in Socket.IO v2

    Features

    Bug Fixes

    • allow integers as event names (1c220dd)

    ... (truncated)

    Changelog

    Sourced from socket.io's changelog.

    3.1.2 (2021-02-26)

    Bug Fixes

    • ignore packets received after disconnection (494c64e)

    3.1.1 (2021-02-03)

    Bug Fixes

    • properly parse the CONNECT packet in v2 compatibility mode (6f4bd7f)
    • typings: add return types and general-case overload signatures (#3776) (9e8f288)
    • typings: update the types of "query", "auth" and "headers" (4f2e9a7)

    3.1.0 (2021-01-15)

    Features

    Bug Fixes

    • allow integers as event names (1c220dd)

    2.4.1 (2021-01-07)

    Reverts

    • fix(security): do not allow all origins by default (a169050)
    Commits
    • 225ade0 chore(release): 3.1.2
    • 494c64e fix: ignore packet received after disconnection
    • 67a61e3 chore: loosen the version requirement of @​types/node
    • 7467216 docs(examples): 4th and final part of the "private messaging" example
    • 7247b40 docs(examples): 3rd part of the "private messaging" example
    • 992c938 docs(examples): 2nd part of the "private messaging" example
    • 8b404f4 docs(examples): 1st part of the "private messaging" example
    • 12221f2 chore(release): 3.1.1
    • 6f4bd7f fix: properly parse the CONNECT packet in v2 compatibility mode
    • 4f2e9a7 fix(typings): update the types of "query", "auth" and "headers"
    • Additional commits viewable in compare view

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language

    You can disable automated security fix PRs for this repo from the Security Alerts page.

    dependencies 
    opened by dependabot[bot] 0
Releases(3.1.0)
  • 3.1.0(Oct 12, 2021)

    Bug Fixes

    • lower the minimum CMake supported version (b196fa7)
    • handle closing sockets upon on_fail events (d1c73b7)
    • resolve client_impl::ping LOG call syntax in debug builds (e7de4eb)

    Features

    • allow resource path to be set in connection URI (#134) (36a8cd4)
    • add support for logging configuration (1b42ce7)
    • support TLSv1.2 and newer (#321) (82d39a9)

    Diff: https://github.com/socketio/socket.io-client-cpp/compare/3.0.0...3.1.0

    Source code(tar.gz)
    Source code(zip)
  • 2.1.0(Oct 12, 2021)

  • 3.0.0(Jan 9, 2021)

  • 2.0.0(Jan 9, 2021)

    Please note that previous versions were already compatible with both Socket.IO v1 and v2. The major bump is due to the breaking changes below:

    • remove Boost dependency (https://github.com/socketio/socket.io-client-cpp/commit/af68bf3067ab45dc6a53261284e0da9afd21b636)
    • use standard install paths (https://github.com/socketio/socket.io-client-cpp/commit/d353647b39c849da858aee041858d348c677dbcb)

    Diff: https://github.com/socketio/socket.io-client-cpp/compare/1.6.1...2.0.0

    Source code(tar.gz)
    Source code(zip)
  • 1.6.1(Sep 20, 2015)

  • 1.5.0(Jun 15, 2015)

    Changes:

    • Breaking change for ack callback interface, replace the argument type message::ptr with message::list.
      • get_double() for int_message
    • merge PR#24
    Source code(tar.gz)
    Source code(zip)
  • 1.4.1(Jun 3, 2015)

  • 1.4.0(May 22, 2015)

    • Add 'tls' secured tunnel support. Install OpenSSL and re-make, you will find the static library libsioclient_tls.a

    This is for secured communication only.

    • Bug fixing.
    • String message optimization using move constructor..
    Source code(tar.gz)
    Source code(zip)
  • 1.3.3(May 6, 2015)

  • 1.3.2(Apr 29, 2015)

  • 1.3.1(Apr 26, 2015)

  • 1.3.0(Apr 20, 2015)

  • 1.3.0-alpha1(Apr 19, 2015)

  • 1.2.2(Apr 15, 2015)

  • 1.2.1(Apr 14, 2015)

  • 1.2.0(Apr 13, 2015)

    Changes:

    • Reconnection APIs change, add transparent reconnecting feature
      • remove reconnect(std::string const& url).
      • Add set_reconnect_attempts, set_reconnect_delay , set_reconnect_delay_max ,set_reconnecting_listener, set_reconnect_listener for transparent reconnecting. All of them are optional to set values.
    • Fix a bug of ignoring the first binary in the received message, reported in issue: #3
    Source code(tar.gz)
    Source code(zip)
  • 1.1.1(Apr 13, 2015)

  • 1.1.0(Apr 13, 2015)

    Changes: Mutliplex supported. - class socket added for namespaces scoped operations. - add socket management api socket(namespace) in class client. - add socket_open_listener and socket_close_listener in class client to receive socket open/close events.

    Source code(tar.gz)
    Source code(zip)
Owner
Socket.IO
Socket.IO
Simple server and client using python socket and declarative programming

Socket-programming Simple server and client using python socket and declarative programming How to use? open cmd and navigate to the location of the s

MAINAK CHAUDHURI 24 Dec 17, 2022
Multithreaded client socket server

-------------------------------------------------------------------------------------- File structure ------------------------------------------------

Ashish Kaushik 2 Nov 15, 2022
A beginner friendly Client-Server program in C. Socket Programming in C

basic-client-server Program on basic client-server connection. This is intended to whomever it may be useful. If you use this somewhere else, proper r

Abdul Samad 1 Oct 21, 2021
A toy implementation of socket programming for Lean 4.

Lean4-Socket A toy implementation of socket programming for Lean 4. Installation Lake import Lake open System Lake DSL package foo where dependenci

王虛白 18 Jul 21, 2022
Faster termux-am implementation that connects to a receiver in termux-app using a unix socket

termux-am-socket This is a small program for sending commands to the Termux:API app, thereby allowing terminal programs to use the Android API. The pr

Termux 26 Dec 21, 2022
HP-Socket bindings for aardio

HP-Socket-bindings-for-aardio HP-Socket is a high performance network framework. aardio is an extremely easy-to-use dynamic language, but it is also a

null 9 Jan 3, 2022
Small utility that leverages eBPF to dump the traffic of a unix domain socket

UnixDump UnixDump is a small eBPF powered utility that can be used to dump unix socket traffic. System requirements This project was developed on a Ub

Guillaume Fournier 8 Nov 19, 2022
Socket server for DAZ Studio meant for use with Streamdeck plug-in

StreamDeckSocket This listens on port 8080 of localhost. If the port is inconvenient, change it in "qhttpserver.h" as LISTEN_PORT do not change the LI

Stephen 5 Dec 27, 2022
As a Teaching Assistant, this is a sample project about socket programming for my teaching in a capstone course in NTUST(National Taiwan University of Science and Technology)

socket-programming As a Teaching Assistant, this is a sample project about socket programming for my teaching in a capstone course in NTUST(National T

Chang Wei 2 Oct 26, 2021
Modern C++ socket library.

sockpp Simple, modern, C++ socket library. This is a fairly low-level C++ wrapper around the Berkeley sockets library using socket, acceptor, and conn

Frank Pagliughi 532 Dec 28, 2022
Lightweight, header-only, Boost-based socket pool library

Stream-client This is a lightweight, header-only, Boost-based library providing client-side network primitives to easily organize and implement data t

Tinkoff.ru 12 Aug 5, 2022
簡單的 socket programming 入門筆記。

socket programming socket 本質上是一種 IPC (Inter-Process Communication) 的技術,用於兩個或多個 process 進行資料交換或者通訊。 在網路領域,socket 著重的不是同一台主機間 process 的通訊,而是不同主機執行的 proc

davidleitw 26 Nov 24, 2022
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
A single-header socket library for both Linux and Windows

COMS What is COMS? COMS is a single-header library designed to be simple to use. It supports TCP and UDP, Server and Client. Available for Windows and

null 5 Dec 23, 2021
Wrapper for linux TCP/UDP/unix/USB socket connections

Socket Connection wrapper shared library Shared library that realize sockets connections and could transfer data-packages. Navigation Navigation Insta

Dmitry Golgovsky 7 Dec 21, 2021
Socket and Networking Library using msgpack.org[C++11]

netLink C++ 11 KISS principle networking library. Features: C++ 11 IPv4, IPv6 Protocols: TCP, UDP Enable/Disable blocking mode Join/Leave UDP-Multicas

Alexander Meißner 210 Oct 18, 2022
A socket daemon to multiplex connections from and to iOS devices

usbmuxd A socket daemon to multiplex connections from and to iOS devices. Features usbmuxd stands for "USB multiplexing daemon". This daemon is in cha

libimobiledevice 1.2k Jan 7, 2023
Portable, single-file, protocol-agnostic TCP and UDP socket wrapper, primarily for game networking

Documentation This is a header-only library, as such most of its functional documentation is contained within the "header section" of the source code

null 64 Dec 3, 2022
Minimalistic socket library inspired by Asio/Boost Asio, implemented in 1 single header file

cz-spas czspas (Small Portable Asynchronous Sockets) is minimalistic socket library inspired by Asio/Boost Asio, implemented in 1 single header file.

Rui Figueira 26 Nov 30, 2022