Search code examples
c++c++11websocketboost-asiowebsocket++

Handle websocketpp connection path


I'm really newbie in websocketpp. Can you tell me please, how can i get websocket connection path on new connection in my server? I mean i need to get the part of this:

ws://localhost:8080/addr1    ------> get addr1
ws://localhost:8080/addr2    ------> get addr2
ws://localhost:8080/etc      ------> get etc

I'm using now an example from this link: http://www.zaphoyd.com/websocketpp/manual/common-patterns/storing-connection-specificsession-information


Solution

  • Well, i found soultion by myself :) You should use following code for that purpose:

    server::connection_ptr con = s.get_con_from_hdl(hdl);
    std::string path = con->get_resource();