Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
TCivetwebWSEngine Class Reference

TCivetwebWSEngine.

Implementation of THttpWSEngine for Civetweb

Definition at line 32 of file TCivetweb.cxx.

Public Member Functions

 TCivetwebWSEngine (struct mg_connection *conn)
 ~TCivetwebWSEngine () override=default
void ClearHandle (Bool_t terminate) override
UInt_t GetId () const override
virtual void PostProcess (std::shared_ptr< THttpCallArg > &arg)
 Method invoked after user process data received via websocket.
virtual Bool_t PreProcess (std::shared_ptr< THttpCallArg > &arg)
 Method should be invoked before processing data coming from websocket If method returns kTRUE, data is processed internally and not dedicated for further usage.
void Send (const void *buf, int len) override
void SendCharStar (const char *str) override
 Envelope for sending string via the websocket.
void SendHeader (const char *hdr, const void *buf, int len) override
 Special method to send binary data with text header For normal websocket it is two separated operation, for other engines could be combined together, but emulates as two messages on client side.

Protected Member Functions

virtual Bool_t CanSendDirectly ()
 One always can send data to websocket - as long as previous send operation completed.
Bool_t SupportSendThrd () const override
 True websocket requires extra thread to parallelize sending.

Protected Attributes

struct mg_connectionfWSconn

Private Types

enum  { kNone , kData , kHeader , kText }

Private Attributes

std::condition_variable fCond
 ! condition used to sync with sending thread
std::string fData
 ! data (binary or text)
bool fDisabled {false}
 ! true shortly before cleanup, set under locked fMutex from WSHandler
bool fHasSendThrd {false}
 ! if thread was started one have to call join method for it
std::string fHdr
 ! header
bool fMTSend {false}
 ! true when send operation runs, set under locked fMutex from WSHandler
std::mutex fMutex
 ! protects all data behind
bool fSending {false}
 ! performing send operation in other thread
std::thread fSendThrd
 ! dedicated thread for all send operations
bool fWaiting {false}
 ! if condition wait is called
enum THttpWSEngine:: { ... }  kNone
 ! kind of operation
Inheritance diagram for TCivetwebWSEngine:
THttpWSEngine

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
privateinherited
Enumerator
kNone 
kData 
kHeader 
kText 

Definition at line 41 of file THttpWSEngine.h.

Constructor & Destructor Documentation

◆ TCivetwebWSEngine()

TCivetwebWSEngine::TCivetwebWSEngine ( struct mg_connection * conn)
inline

Definition at line 40 of file TCivetweb.cxx.

◆ ~TCivetwebWSEngine()

TCivetwebWSEngine::~TCivetwebWSEngine ( )
overridedefault

Member Function Documentation

◆ CanSendDirectly()

virtual Bool_t THttpWSEngine::CanSendDirectly ( )
inlineprotectedvirtualinherited

One always can send data to websocket - as long as previous send operation completed.

Reimplemented in THttpLongPollEngine.

Definition at line 52 of file THttpWSEngine.h.

◆ ClearHandle()

void TCivetwebWSEngine::ClearHandle ( Bool_t terminate)
inlineoverridevirtual

Implements THttpWSEngine.

Definition at line 46 of file TCivetweb.cxx.

◆ GetId()

UInt_t TCivetwebWSEngine::GetId ( ) const
inlineoverridevirtual

Implements THttpWSEngine.

Definition at line 44 of file TCivetweb.cxx.

◆ PostProcess()

void THttpWSEngine::PostProcess ( std::shared_ptr< THttpCallArg > & arg)
virtualinherited

Method invoked after user process data received via websocket.

Reimplemented in THttpLongPollEngine.

Definition at line 48 of file THttpWSEngine.cxx.

◆ PreProcess()

Bool_t THttpWSEngine::PreProcess ( std::shared_ptr< THttpCallArg > & arg)
virtualinherited

Method should be invoked before processing data coming from websocket If method returns kTRUE, data is processed internally and not dedicated for further usage.

Reimplemented in THttpLongPollEngine.

Definition at line 40 of file THttpWSEngine.cxx.

◆ Send()

void TCivetwebWSEngine::Send ( const void * buf,
int len )
inlineoverridevirtual

Implements THttpWSEngine.

Definition at line 53 of file TCivetweb.cxx.

◆ SendCharStar()

void TCivetwebWSEngine::SendCharStar ( const char * str)
inlineoverridevirtual

Envelope for sending string via the websocket.

Reimplemented from THttpWSEngine.

Definition at line 71 of file TCivetweb.cxx.

◆ SendHeader()

void TCivetwebWSEngine::SendHeader ( const char * hdr,
const void * buf,
int len )
inlineoverridevirtual

Special method to send binary data with text header For normal websocket it is two separated operation, for other engines could be combined together, but emulates as two messages on client side.

Implements THttpWSEngine.

Definition at line 63 of file TCivetweb.cxx.

◆ SupportSendThrd()

Bool_t TCivetwebWSEngine::SupportSendThrd ( ) const
inlineoverrideprotectedvirtual

True websocket requires extra thread to parallelize sending.

Reimplemented from THttpWSEngine.

Definition at line 37 of file TCivetweb.cxx.

Member Data Documentation

◆ fCond

std::condition_variable THttpWSEngine::fCond
privateinherited

! condition used to sync with sending thread

Definition at line 38 of file THttpWSEngine.h.

◆ fData

std::string THttpWSEngine::fData
privateinherited

! data (binary or text)

Definition at line 42 of file THttpWSEngine.h.

◆ fDisabled

bool THttpWSEngine::fDisabled {false}
privateinherited

! true shortly before cleanup, set under locked fMutex from WSHandler

Definition at line 32 of file THttpWSEngine.h.

◆ fHasSendThrd

bool THttpWSEngine::fHasSendThrd {false}
privateinherited

! if thread was started one have to call join method for it

Definition at line 35 of file THttpWSEngine.h.

◆ fHdr

std::string THttpWSEngine::fHdr
privateinherited

! header

Definition at line 43 of file THttpWSEngine.h.

◆ fMTSend

bool THttpWSEngine::fMTSend {false}
privateinherited

! true when send operation runs, set under locked fMutex from WSHandler

Definition at line 31 of file THttpWSEngine.h.

◆ fMutex

std::mutex THttpWSEngine::fMutex
privateinherited

! protects all data behind

Definition at line 37 of file THttpWSEngine.h.

◆ fSending

bool THttpWSEngine::fSending {false}
privateinherited

! performing send operation in other thread

Definition at line 40 of file THttpWSEngine.h.

◆ fSendThrd

std::thread THttpWSEngine::fSendThrd
privateinherited

! dedicated thread for all send operations

Definition at line 34 of file THttpWSEngine.h.

◆ fWaiting

bool THttpWSEngine::fWaiting {false}
privateinherited

! if condition wait is called

Definition at line 39 of file THttpWSEngine.h.

◆ fWSconn

struct mg_connection* TCivetwebWSEngine::fWSconn
protected

Definition at line 34 of file TCivetweb.cxx.

◆ []

enum { ... } THttpWSEngine::kNone

! kind of operation


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