Is it possible to to create a server with several endpoints by QWebSocketServer?



  • Could I use QWebSocketServer to "register" different endpoints like

    Examples

    ws://some_address/update_image
    ws://some_address/download_image
    ws://some_address/car_monitor

    etc.

    I have wrote a simple application by QWevSocketServer, but have no idea how could I add more endpoints to it. If there is no way or hard to be done by QWebSocketServer, I will add a "mode" field in my json file in order to process different tasks. Thank you very much.


  • Moderators

    @tham Sure. But not like you would think. Basically once you accept the connection to the websocket, you can then get the URL with something like sock->requestUrl() and then act accordingly based on the URL you received.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.