in chime-sdk-signaling-cpp/src/transport/websocket_signaling_transport.cc [33:59]
bool WebsocketSignalingTransport::SendSignalFrame(signal_sdk::SdkSignalFrame& frame) {
const auto current_ms =
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
frame.set_timestamp_ms(current_ms.count());
LogLevel signaling_log_level =
frame.type() != signal_sdk::SdkSignalFrame::CLIENT_METRIC ? LogLevel::kInfo : LogLevel::kVerbose;
CHIME_LOG(signaling_log_level, "Sending control message: type=" + signal_frame_type_strings[frame.type()]);
std::string buff;
if (!frame.SerializeToString(&buff)) {
// If we failed to send a message we should stop since our state
// might not be recoverable unless we restart everything
CHIME_LOG(LogLevel::kError, "Unable to serialize string error")
return false;
}
std::vector<uint8_t> data(buff.length() + 1);
// Add type for the first byte.
data[0] = video_type;
std::copy(buff.begin(), buff.end(), data.begin() + 1);
websocket_->SendBinary(data);
return true;
}