mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-22 23:25:33 +00:00
Fixed closed callback
This commit is contained in:
@ -32,9 +32,9 @@ using namespace std;
|
||||
template <class T> weak_ptr<T> make_weak_ptr(shared_ptr<T> ptr) { return ptr; }
|
||||
|
||||
void test_websocket() {
|
||||
InitLogger(LogLevel::Verbose);
|
||||
InitLogger(LogLevel::Debug);
|
||||
|
||||
const string myMessage = "Hello world";
|
||||
const string myMessage = "Hello world from libdatachannel";
|
||||
|
||||
auto ws = std::make_shared<WebSocket>();
|
||||
|
||||
@ -46,6 +46,8 @@ void test_websocket() {
|
||||
ws->send(myMessage);
|
||||
});
|
||||
|
||||
ws->onClosed([]() { cout << "WebSocket: Closed" << endl; });
|
||||
|
||||
std::atomic<bool> received = false;
|
||||
ws->onMessage([&received, &myMessage](const variant<binary, string> &message) {
|
||||
if (holds_alternative<string>(message)) {
|
||||
|
Reference in New Issue
Block a user