MCPcopy Create free account
hub / github.com/Tracktion/choc / getHTTPContent

Method getHTTPContent

examples/http_server.cpp:72–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

70 }
71
72 choc::network::HTTPContent getHTTPContent (std::string_view path) override
73 {
74 // This path is asking for the default page content
75 if (path == "/")
76 {
77 // When we return the content for the page, we'll embed the URL into it that
78 // it'll need to use to open the websocket back to this address..
79 auto pageContent = choc::text::replace (demoPageHTML,
80 "SOCKET_URL", choc::json::getEscapedQuotedString (server.getWebSocketAddress()));
81
82 return choc::network::HTTPContent::forHTML (pageContent);
83 }
84
85 // If you want to serve content for other paths, you would do that here...
86
87 return {};
88 }
89
90 void upgradedToWebSocket (std::string_view path) override
91 {

Callers

nothing calls this directly

Calls 3

replaceFunction · 0.85
getEscapedQuotedStringFunction · 0.85
getWebSocketAddressMethod · 0.80

Tested by

no test coverage detected