| 164 | } |
| 165 | |
| 166 | void EventSub::Disconnect() |
| 167 | { |
| 168 | std::lock_guard<std::mutex> lock(_connectMtx); |
| 169 | _disconnect = true; |
| 170 | websocketpp::lib::error_code ec; |
| 171 | _client->close(_connection, websocketpp::close::status::normal, |
| 172 | "Twitch EventSub stopping", ec); |
| 173 | { |
| 174 | std::unique_lock<std::mutex> waitLock(_waitMtx); |
| 175 | _cv.notify_all(); |
| 176 | } |
| 177 | |
| 178 | if (_thread.joinable()) { |
| 179 | _thread.join(); |
| 180 | } |
| 181 | _connected = false; |
| 182 | ClearActiveSubscriptions(); |
| 183 | } |
| 184 | |
| 185 | EventSubMessageBuffer EventSub::RegisterForEvents() |
| 186 | { |