Twitch SDK (Internal)
Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Attributes | List of all members
ttv::chat::ChatSocketTransport Class Reference

#include <chatsockettransport.h>

Inheritance diagram for ttv::chat::ChatSocketTransport:
ttv::chat::IChatTransport

Public Member Functions

 ChatSocketTransport ()
 
virtual ~ChatSocketTransport ()
 
virtual TTV_ErrorCode Connect (const std::string &uri)
 
virtual TTV_ErrorCode Close ()
 
virtual bool IsOpen ()
 
virtual void SetReader (std::shared_ptr< IChatTransportReader > reader)
 
virtual TTV_ErrorCode ProcessIncomingEvent (bool &handled)
 
virtual TTV_ErrorCode Write (const char *pData, size_t nSize)
 

Static Public Member Functions

static TTV_ErrorCode CheckFactoryAvailability (const std::string &uri)
 

Static Public Attributes

static const uint32_t kMaxIrcTextLength = 2048
 The max number of bytes allowed in the text area of the message. More...
 
static const uint32_t kMaxIrcTagsLength = 4096
 The max number of bytes allowed in the IRCv3 tags area of the message. More...
 
static const uint32_t kMaxBufferSize = kMaxIrcTextLength + kMaxIrcTagsLength
 

Private Attributes

std::shared_ptr< IChatTransportReadermReader
 The reader who will be notified when data is received. More...
 
std::shared_ptr< ISocketmSocket
 The raw socket for sending and receiving chat messages on. More...
 
std::shared_ptr< IWebSocketmWebSocket
 The websocket for sending and receiving chat messages on. More...
 
std::vector< char > mBuffer
 A scratch buffer for reading data. More...
 

Detailed Description

An implementation of a transport which handles sending and receiving data over a TCP socket.

Constructor & Destructor Documentation

◆ ChatSocketTransport()

ttv::chat::ChatSocketTransport::ChatSocketTransport ( )

◆ ~ChatSocketTransport()

virtual ttv::chat::ChatSocketTransport::~ChatSocketTransport ( )
virtual

Member Function Documentation

◆ CheckFactoryAvailability()

static TTV_ErrorCode ttv::chat::ChatSocketTransport::CheckFactoryAvailability ( const std::string &  uri)
static

◆ Close()

virtual TTV_ErrorCode ttv::chat::ChatSocketTransport::Close ( )
virtual

◆ Connect()

virtual TTV_ErrorCode ttv::chat::ChatSocketTransport::Connect ( const std::string &  uri)
virtual

◆ IsOpen()

virtual bool ttv::chat::ChatSocketTransport::IsOpen ( )
virtual

◆ ProcessIncomingEvent()

virtual TTV_ErrorCode ttv::chat::ChatSocketTransport::ProcessIncomingEvent ( bool &  handled)
virtual

Reads a single incoming event. Does not block. This will make calls into the reader.

Parameters
handledWhether or not there was an event to handle.

Implements ttv::chat::IChatTransport.

◆ SetReader()

virtual void ttv::chat::ChatSocketTransport::SetReader ( std::shared_ptr< IChatTransportReader reader)
virtual

Sets the reader which will receive data from reads.

Implements ttv::chat::IChatTransport.

◆ Write()

virtual TTV_ErrorCode ttv::chat::ChatSocketTransport::Write ( const char *  pData,
size_t  nSize 
)
virtual

Writes the given data to the transport.

Implements ttv::chat::IChatTransport.

Member Data Documentation

◆ kMaxBufferSize

const uint32_t ttv::chat::IChatTransport::kMaxBufferSize = kMaxIrcTextLength + kMaxIrcTagsLength
staticinherited

◆ kMaxIrcTagsLength

const uint32_t ttv::chat::IChatTransport::kMaxIrcTagsLength = 4096
staticinherited

The max number of bytes allowed in the IRCv3 tags area of the message.

◆ kMaxIrcTextLength

const uint32_t ttv::chat::IChatTransport::kMaxIrcTextLength = 2048
staticinherited

The max number of bytes allowed in the text area of the message.

◆ mBuffer

std::vector<char> ttv::chat::ChatSocketTransport::mBuffer
private

A scratch buffer for reading data.

◆ mReader

std::shared_ptr<IChatTransportReader> ttv::chat::ChatSocketTransport::mReader
private

The reader who will be notified when data is received.

◆ mSocket

std::shared_ptr<ISocket> ttv::chat::ChatSocketTransport::mSocket
private

The raw socket for sending and receiving chat messages on.

◆ mWebSocket

std::shared_ptr<IWebSocket> ttv::chat::ChatSocketTransport::mWebSocket
private

The websocket for sending and receiving chat messages on.


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