adding in examples of headers and origin
This commit is contained in:
@@ -25,7 +25,11 @@ int main()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::unique_ptr<WebSocket> ws(WebSocket::from_url("ws://localhost:8126/foo"));
|
std::map<std::string, std::string> headers;
|
||||||
|
headers.insert(std::make_pair("Authorization", "Bearer 123"));
|
||||||
|
std::string origin = "https://example.com";
|
||||||
|
|
||||||
|
std::unique_ptr<WebSocket> ws(WebSocket::from_url("ws://localhost:8126/foo", origin, headers));
|
||||||
assert(ws);
|
assert(ws);
|
||||||
ws->send("goodbye");
|
ws->send("goodbye");
|
||||||
ws->send("hello");
|
ws->send("hello");
|
||||||
|
|||||||
+4
-1
@@ -29,8 +29,11 @@ int main()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
std::map<std::string, std::string> headers;
|
||||||
|
headers.insert(std::make_pair("Authorization", "Bearer 123"));
|
||||||
|
std::string origin = "https://example.com";
|
||||||
|
|
||||||
ws = WebSocket::from_url("ws://localhost:8126/foo");
|
ws = WebSocket::from_url("ws://localhost:8126/foo", origin, headers);
|
||||||
assert(ws);
|
assert(ws);
|
||||||
ws->send("goodbye");
|
ws->send("goodbye");
|
||||||
ws->send("hello");
|
ws->send("hello");
|
||||||
|
|||||||
Reference in New Issue
Block a user