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_connection * | fWSconn |
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 | |
|
privateinherited |
| Enumerator | |
|---|---|
| kNone | |
| kData | |
| kHeader | |
| kText | |
Definition at line 41 of file THttpWSEngine.h.
|
inline |
Definition at line 40 of file TCivetweb.cxx.
|
overridedefault |
|
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.
|
inlineoverridevirtual |
Implements THttpWSEngine.
Definition at line 46 of file TCivetweb.cxx.
|
inlineoverridevirtual |
Implements THttpWSEngine.
Definition at line 44 of file TCivetweb.cxx.
|
virtualinherited |
Method invoked after user process data received via websocket.
Reimplemented in THttpLongPollEngine.
Definition at line 48 of file THttpWSEngine.cxx.
|
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.
|
inlineoverridevirtual |
Implements THttpWSEngine.
Definition at line 53 of file TCivetweb.cxx.
|
inlineoverridevirtual |
Envelope for sending string via the websocket.
Reimplemented from THttpWSEngine.
Definition at line 71 of file TCivetweb.cxx.
|
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.
|
inlineoverrideprotectedvirtual |
True websocket requires extra thread to parallelize sending.
Reimplemented from THttpWSEngine.
Definition at line 37 of file TCivetweb.cxx.
|
privateinherited |
! condition used to sync with sending thread
Definition at line 38 of file THttpWSEngine.h.
|
privateinherited |
! data (binary or text)
Definition at line 42 of file THttpWSEngine.h.
|
privateinherited |
! true shortly before cleanup, set under locked fMutex from WSHandler
Definition at line 32 of file THttpWSEngine.h.
|
privateinherited |
! if thread was started one have to call join method for it
Definition at line 35 of file THttpWSEngine.h.
|
privateinherited |
! header
Definition at line 43 of file THttpWSEngine.h.
|
privateinherited |
! true when send operation runs, set under locked fMutex from WSHandler
Definition at line 31 of file THttpWSEngine.h.
|
privateinherited |
! protects all data behind
Definition at line 37 of file THttpWSEngine.h.
|
privateinherited |
! performing send operation in other thread
Definition at line 40 of file THttpWSEngine.h.
|
privateinherited |
! dedicated thread for all send operations
Definition at line 34 of file THttpWSEngine.h.
|
privateinherited |
! if condition wait is called
Definition at line 39 of file THttpWSEngine.h.
|
protected |
Definition at line 34 of file TCivetweb.cxx.
| enum { ... } THttpWSEngine::kNone |
! kind of operation