socket.io-client-cpp icon indicating copy to clipboard operation
socket.io-client-cpp copied to clipboard

Error getting remote endpoint

Open Suresh3d opened this issue 3 months ago • 0 comments

I am getting these errors when. trying to connect to the server . Can anyone help with this ?

[info] Error getting remote endpoint: asio.system:57 (Socket is not connected) [2025-08-22 13:28:04] [error] handle_connect error: Timer Expired

here is the code ,

    `sio::client h;

    // ---- Connection Open ----
    h.set_open_listener([&]() {
        std::cout << "Connected!" << std::endl;
    });

    // ---- Connection Failed ----
    h.set_fail_listener([&]() {
        std::cout << " Connection failed" << std::endl;
    });

    // ---- Connection Closed ----
    h.set_close_listener([&](sio::client::close_reason const& reason) {
        std::cout << "Disconnected." << std::endl;
    });


std::map<std::string, std::string> headers;
headers["User-Agent"] = "cpp-socketio-client";
headers["user"] =  userId;
headers["token"] = token;

h.connect("http://breezeapi.icicidirect.com/ohlcvstream", {}, headers);

sio::message::list join_args;
join_args.push(sio::string_message::create("4.1!7299"));
h.socket()->emit("join", join_args);

    // ---- Tick Updates ----

h.socket()->on("1SEC", [&](sio::event& ev) {
    auto msg = ev.get_message();
            if (msg) {
                std::cout << "📊 Tick Data: " << msg->get_string() << std::endl;
            } else {
                std::cout << "📊 Tick Event (non-string)" << std::endl;
            }
});


std::this_thread::sleep_for(std::chrono::minutes(5));`

Suresh3d avatar Aug 22 '25 08:08 Suresh3d