| 64 | } |
| 65 | |
| 66 | void WsStreamRouter::PostTextMessage(const std::string &data) { |
| 67 | if (!session_ || !session_->is_started()) { |
| 68 | return; |
| 69 | } |
| 70 | |
| 71 | auto tid = tc::GetCurrentThreadID(); |
| 72 | if (post_thread_id_ == 0) { |
| 73 | post_thread_id_ = tid; |
| 74 | } |
| 75 | if (tid != post_thread_id_) { |
| 76 | LOGI("OH NO! Post text message in thread: {}, but the last thread is: {}", tid, post_thread_id_); |
| 77 | } |
| 78 | |
| 79 | session_->ws_stream().text(true); |
| 80 | queuing_message_count_++; |
| 81 | session_->async_send(data, [=, this](size_t byte_sent) { |
| 82 | queuing_message_count_--; |
| 83 | |
| 84 | // report data size |
| 85 | auto plugin = Get<WsPlugin*>("plugin"); |
| 86 | plugin->ReportSentDataSize(byte_sent); |
| 87 | }); |
| 88 | } |
| 89 | } |
nothing calls this directly
no test coverage detected