LiveKit C++ SDK
Real-time audio/video SDK for C++
Loading...
Searching...
No Matches
livekit::TextStreamWriter Class Reference

Writer for outgoing text streams. More...

#include <data_stream.h>

Inheritance diagram for livekit::TextStreamWriter:
Collaboration diagram for livekit::TextStreamWriter:

Public Member Functions

 TextStreamWriter (LocalParticipant &local_participant, const std::string &topic="", const std::map< std::string, std::string > &attributes={}, const std::string &stream_id="", std::optional< std::size_t > total_size=std::nullopt, const std::string &reply_to_id="", const std::vector< std::string > &destination_identities={}, const std::string &sender_identity="")
 
void write (const std::string &text)
 
const TextStreamInfoinfo () const noexcept
 Metadata associated with this stream.
 
- Public Member Functions inherited from livekit::BaseStreamWriter
const std::string & streamId () const noexcept
 Stream id assigned to this writer.
 
const std::string & topic () const noexcept
 Topic of this stream.
 
const std::string & mimeType () const noexcept
 MIME type for this stream.
 
std::int64_t timestampMs () const noexcept
 Timestamp (ms) when the stream was created.
 
bool isClosed () const noexcept
 Whether the stream has been closed.
 
void close (const std::string &reason="", const std::map< std::string, std::string > &attributes={})
 

Additional Inherited Members

- Protected Types inherited from livekit::BaseStreamWriter
enum class  StreamKind { kUnknown , kText , kByte }
 
- Protected Member Functions inherited from livekit::BaseStreamWriter
 BaseStreamWriter (LocalParticipant &local_participant, const std::string &topic="", const std::map< std::string, std::string > &attributes={}, const std::string &stream_id="", std::optional< std::size_t > total_size=std::nullopt, const std::string &mime_type="", const std::vector< std::string > &destination_identities={}, const std::string &sender_identity="")
 
void ensureHeaderSent ()
 
void sendChunk (const std::vector< std::uint8_t > &content)
 
void sendTrailer (const std::string &reason, const std::map< std::string, std::string > &attributes)
 
- Protected Attributes inherited from livekit::BaseStreamWriter
LocalParticipantlocal_participant_
 
std::string stream_id_
 
std::string mime_type_
 
std::string topic_
 
std::int64_t timestamp_ms_ = 0
 
std::optional< std::size_t > total_size_
 
std::map< std::string, std::string > attributes_
 
std::vector< std::string > destination_identities_
 
std::string sender_identity_
 
bool closed_ = false
 
bool header_sent_ = false
 
std::uint64_t next_chunk_index_ = 0
 
StreamKind kind_ = StreamKind::kUnknown
 
std::string reply_to_id_
 
std::string byte_name_
 

Detailed Description

Writer for outgoing text streams.

Member Function Documentation

◆ write()

void livekit::TextStreamWriter::write ( const std::string &  text)

Write a UTF-8 string to the stream. Data will be split into chunks of at most kStreamChunkSize bytes. Throws on error or if the stream is closed.


The documentation for this class was generated from the following file: