TTK
|
#include <WebSocketIO.h>
Classes | |
struct | Message |
Public Member Functions | |
WebSocketIO () | |
~WebSocketIO () override | |
int | isListening () |
virtual int | processEvent (const std::string &eventName, const std::string &eventData="") |
int | startServer (int PortNumber) |
int | stopServer () |
int | getPortNumber () |
int | sendString (const std::string &msg) const |
int | sendBinary (const size_t &sizeInBytes, const void *data) const |
int | sendMessage (const Message &msg) const |
int | queueMessage (const std::string &msg) |
int | queueMessage (const size_t &sizeInBytes, const void *data) |
int | queueMessage (const Message &msg) |
int | sendNextQueuedMessage () |
int | processMessageQueue () |
int | clearMessageQueue () |
![]() | |
Debug () | |
~Debug () override | |
virtual int | setDebugLevel (const int &debugLevel) |
int | setWrapper (const Wrapper *wrapper) override |
int | printMsg (const std::string &msg, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::string > &msgs, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printErr (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printWrn (const std::string &msg, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cerr) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const double &memory, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const double &time, const int &threads, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::PERFORMANCE, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const double &progress, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::vector< std::vector< std::string > > &rows, const debug::Priority &priority=debug::Priority::INFO, const bool hasHeader=true, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
int | printMsg (const debug::Separator &separator, const debug::Priority &priority, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsg (const std::string &msg, const debug::Separator &separator, const debug::LineMode &lineMode=debug::LineMode::NEW, const debug::Priority &priority=debug::Priority::INFO, std::ostream &stream=std::cout) const |
void | setDebugMsgPrefix (const std::string &prefix) |
![]() | |
BaseClass () | |
virtual | ~BaseClass ()=default |
int | getThreadNumber () const |
virtual int | setThreadNumber (const int threadNumber) |
Additional Inherited Members | |
![]() | |
int | printMsgInternal (const std::string &msg, const std::string &right, const std::string &filler, const debug::Priority &priority=debug::Priority::INFO, const debug::LineMode &lineMode=debug::LineMode::NEW, std::ostream &stream=std::cout) const |
int | printMsgInternal (const std::string &msg, const debug::Priority &priority, const debug::LineMode &lineMode, std::ostream &stream=std::cout) const |
int | welcomeMsg (std::ostream &stream) |
![]() | |
int | debugLevel_ |
std::string | debugMsgPrefix_ |
std::string | debugMsgNamePrefix_ |
![]() | |
bool | lastObject_ |
int | threadNumber_ |
Wrapper * | wrapper_ |
![]() | |
static COMMON_EXPORTS debug::LineMode | lastLineMode = ttk::debug::LineMode::NEW |
This module provides functions for bi-directional communication between two websockets, where the heavy lifting is done by the websocketpp library. The primary use case for this module is to send data that was computed in a c++ environment to a browser client, which can then freely process/render the data via JavaScript and HTML. To this end, this module needs to run a websocket server, to which a client can connect to via the ttkWebSocketIO.js library. The server can also receive data from the client, which is then fed into the processEvent function. In order to add custom processing of events, one needs to inherit from the WebSocketIO class and override the processEvent method. The vtk wrapper ttkWebSocketIO provides an example on how this abstract base module can be specialized to the application of sending/receiving vtkDataObjects. Specifically, the ttkWebSocketIO filter will send its input vtkDataObject as a serialized JSON object to all connected clients every time the filter is called with a new input. When the server receives a serialized JSON object form the client, then the filter will instantiate a vtkDataObject and pass it as the filter output.
Definition at line 51 of file WebSocketIO.h.
ttk::WebSocketIO::WebSocketIO | ( | ) |
Definition at line 5 of file WebSocketIO.cpp.
|
override |
Definition at line 31 of file WebSocketIO.cpp.
int ttk::WebSocketIO::clearMessageQueue | ( | ) |
Definition at line 329 of file WebSocketIO.cpp.
int ttk::WebSocketIO::getPortNumber | ( | ) |
Definition at line 301 of file WebSocketIO.cpp.
int ttk::WebSocketIO::isListening | ( | ) |
Definition at line 298 of file WebSocketIO.cpp.
|
virtual |
Reimplemented in ttkWebSocketIO.
Definition at line 338 of file WebSocketIO.cpp.
int ttk::WebSocketIO::processMessageQueue | ( | ) |
Definition at line 335 of file WebSocketIO.cpp.
int ttk::WebSocketIO::queueMessage | ( | const Message & | msg | ) |
Definition at line 326 of file WebSocketIO.cpp.
int ttk::WebSocketIO::queueMessage | ( | const size_t & | sizeInBytes, |
const void * | data | ||
) |
Definition at line 323 of file WebSocketIO.cpp.
int ttk::WebSocketIO::queueMessage | ( | const std::string & | msg | ) |
Definition at line 320 of file WebSocketIO.cpp.
int ttk::WebSocketIO::sendBinary | ( | const size_t & | sizeInBytes, |
const void * | data | ||
) | const |
Definition at line 313 of file WebSocketIO.cpp.
int ttk::WebSocketIO::sendMessage | ( | const Message & | msg | ) | const |
Definition at line 317 of file WebSocketIO.cpp.
int ttk::WebSocketIO::sendNextQueuedMessage | ( | ) |
Definition at line 332 of file WebSocketIO.cpp.
int ttk::WebSocketIO::sendString | ( | const std::string & | msg | ) | const |
Definition at line 310 of file WebSocketIO.cpp.
int ttk::WebSocketIO::startServer | ( | int | PortNumber | ) |
Definition at line 304 of file WebSocketIO.cpp.
int ttk::WebSocketIO::stopServer | ( | ) |
Definition at line 307 of file WebSocketIO.cpp.