title: How to stream data with websocket with cpprest?
body: <p>I have a cpprestsdk package and using to connect and stream data from some endpoint.</p>
  <pre><code>using namespace web;
  using namespace web::websockets::client;
  websocket_client clientbtcusdt;
  clientbtcusdt.connect(std::wstring(L&quot;wss://stream.binance.com:9443/ws/&quot; + std::wstring(L&quot;btcusdt&quot;) + L&quot;@depth20@100ms&quot;)).wait();
  clientbtcusdt.receive().then([](websocket_incoming_message in_msg)
      {
          return in_msg.extract_string();
      }).then([&amp;](std::string body)
          {
              Json::Value json;
              std::string parsingError;
              std::stringstream streamResponse(body);
              Json::parseFromStream(Json::CharReaderBuilder(), streamResponse, &amp;json, &amp;parsingError);
              std::cout &lt;&lt; json &lt;&lt; std::endl;
          }).wait();
  </code></pre>
  <p>This receives one <code>json</code> message and then closes connection.</p>
  <p>How can I stream permanently?<br />
  If I would stream permanently by wrapping this into infinite loop and then want few such streams, should wrap every infinite loop into callable and attach a thread to every such socket?</p>