Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
ROOT::Experimental::RWebWindowsManager Class Reference

Central instance to create and show web-based windows like Canvas or FitPanel.

Manager responsible to creating THttpServer instance, which is used for RWebWindow's communication with clients.

Method RWebWindowsManager::Show() used to show window in specified location.

Definition at line 31 of file RWebWindowsManager.hxx.

Public Member Functions

 RWebWindowsManager ()
 window manager constructor Required here for correct usage of unique_ptr<THttpServer>
 
 ~RWebWindowsManager ()
 window manager destructor Required here for correct usage of unique_ptr<THttpServer>
 
std::shared_ptr< RWebWindowCreateWindow ()
 Creates new window To show window, RWebWindow::Show() have to be called.
 
THttpServerGetServer () const
 Returns THttpServer instance.
 
std::string GetServerAddr () const
 Returns http address of the server, empty string when not available.
 
void Terminate ()
 Terminate http server and ROOT application.
 

Static Public Member Functions

static void AssignMainThrd ()
 Re-assigns main thread id Normally main thread id recognized at the moment when library is loaded It supposed to be a thread where gApplication->Run() will be called If application runs in separate thread, one have to call this method to let RWebWindowsManager correctly recognize such situation.
 
static std::shared_ptr< RWebWindowsManager > & Instance ()
 Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel.
 
static bool IsMainThrd ()
 Returns true when called from main process Main process recognized at the moment when library is loaded It supposed to be a thread where gApplication->Run() will be called If application runs in separate thread, one have to use AssignMainThrd() method to let RWebWindowsManager correctly recognize such situation.
 

Private Member Functions

bool CreateServer (bool with_http=false)
 Creates http server, if required - with real http engine (civetweb) One could configure concrete HTTP port, which should be used for the server, provide following entry in rootrc file:
 
float GetLaunchTmout () const
 Returns timeout for launching new browser process.
 
std::string GetUrl (const RWebWindow &win, bool remote=false)
 Provide URL address to access specified window from inside or from remote.
 
bool IsUseHttpThread () const
 Returns true if http server use special thread for requests processing (default off)
 
bool IsUseSenderThreads () const
 Returns true if extra threads to send data via websockets will be used (default off)
 
unsigned ShowWindow (RWebWindow &win, bool batch_mode, const RWebDisplayArgs &args)
 Show window in specified location, see Show() method for more details.
 
void Unregister (RWebWindow &win)
 Release all references to specified window Called from RWebWindow destructor.
 
int WaitFor (RWebWindow &win, WebWindowWaitFunc_t check, bool timed=false, double tm=-1)
 Waits until provided check function or lambdas returns non-zero value Regularly calls WebWindow::Sync() method to let run event loop If call from the main thread, runs system events processing Check function has following signature: int func(double spent_tm) Parameter spent_tm is time in seconds, which already spent inside function Waiting will be continued, if function returns zero.
 

Private Attributes

std::string fAddr
 ! HTTP address of the server
 
unsigned fIdCnt {0}
 ! counter for identifiers
 
float fLaunchTmout {30.}
 ! timeout in seconds to start browser process, default 30s
 
std::recursive_mutex fMutex
 ! main mutex, used for window creations
 
std::unique_ptr< THttpServerfServer
 ! central communication with the all used displays
 
bool fUseHttpThrd {false}
 ! use special thread for THttpServer
 
bool fUseSenderThreads {false}
 ! use extra threads for sending data from RWebWindow to clients
 

Friends

class RWebWindow
 

#include <ROOT/RWebWindowsManager.hxx>

Constructor & Destructor Documentation

◆ RWebWindowsManager()

RWebWindowsManager::RWebWindowsManager ( )
default

window manager constructor Required here for correct usage of unique_ptr<THttpServer>

◆ ~RWebWindowsManager()

RWebWindowsManager::~RWebWindowsManager ( )

window manager destructor Required here for correct usage of unique_ptr<THttpServer>

Definition at line 102 of file RWebWindowsManager.cxx.

Member Function Documentation

◆ AssignMainThrd()

void RWebWindowsManager::AssignMainThrd ( )
static

Re-assigns main thread id Normally main thread id recognized at the moment when library is loaded It supposed to be a thread where gApplication->Run() will be called If application runs in separate thread, one have to call this method to let RWebWindowsManager correctly recognize such situation.

Definition at line 86 of file RWebWindowsManager.cxx.

◆ CreateServer()

bool RWebWindowsManager::CreateServer ( bool  with_http = false)
private

Creates http server, if required - with real http engine (civetweb) One could configure concrete HTTP port, which should be used for the server, provide following entry in rootrc file:

 WebGui.HttpPort: 8088

or specify range of http ports, which can be used:

 WebGui.HttpPortMin: 8800
 WebGui.HttpPortMax: 9800

By default range [8800..9800] is used

One also can bind HTTP server socket to loopback address, In that case only connection from localhost will be available:

 WebGui.HttpLoopback: yes

Or one could specify hostname which should be used for binding of server socket

 WebGui.HttpBind: hostname | ipaddress

To use secured protocol, following parameter should be specified

 WebGui.UseHttps: yes
 WebGui.ServerCert: sertificate_filename.pem

One also can configure usage of special thread of processing of http server requests

 WebGui.HttpThrd: no

Extra threads can be used to send data to different clients via websocket (default no)

 WebGui.SenderThrds: no

If required, one could change websocket timeouts (default is 10000 ms)

 WebGui.HttpWSTmout: 10000

By default, THttpServer created in restricted mode which only allows websocket handlers and processes only very few other related http requests. For security reasons such mode should be always enabled. Only if it is really necessary to process all other kinds of HTTP requests, one could specify 0 for following parameter (default 1):

 WebGui.WSOnly: 1

Following parameter controls browser max-age caching parameter for files (default 3600)

 WebGui.HttpMaxAge: 3600

One also can configure usage of FastCGI server for web windows:

 WebGui.FastCgiPort: 4000
 WebGui.FastCgiThreads: 10

To be able start web browser for such windows, one can provide real URL of the web server which will connect with that FastCGI instance:

 WebGui.FastCgiServer: https://your_apache_server.com/root_cgi_path

Definition at line 172 of file RWebWindowsManager.cxx.

◆ CreateWindow()

std::shared_ptr< RWebWindow > RWebWindowsManager::CreateWindow ( )

Creates new window To show window, RWebWindow::Show() have to be called.

Definition at line 320 of file RWebWindowsManager.cxx.

◆ GetLaunchTmout()

float ROOT::Experimental::RWebWindowsManager::GetLaunchTmout ( ) const
inlineprivate

Returns timeout for launching new browser process.

Definition at line 51 of file RWebWindowsManager.hxx.

◆ GetServer()

THttpServer * ROOT::Experimental::RWebWindowsManager::GetServer ( ) const
inline

Returns THttpServer instance.

Definition at line 70 of file RWebWindowsManager.hxx.

◆ GetServerAddr()

std::string ROOT::Experimental::RWebWindowsManager::GetServerAddr ( ) const
inline

Returns http address of the server, empty string when not available.

Definition at line 73 of file RWebWindowsManager.hxx.

◆ GetUrl()

std::string RWebWindowsManager::GetUrl ( const RWebWindow win,
bool  remote = false 
)
private

Provide URL address to access specified window from inside or from remote.

Definition at line 375 of file RWebWindowsManager.cxx.

◆ Instance()

std::shared_ptr< RWebWindowsManager > & RWebWindowsManager::Instance ( )
static

Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel.

Definition at line 51 of file RWebWindowsManager.cxx.

◆ IsMainThrd()

bool RWebWindowsManager::IsMainThrd ( )
static

Returns true when called from main process Main process recognized at the moment when library is loaded It supposed to be a thread where gApplication->Run() will be called If application runs in separate thread, one have to use AssignMainThrd() method to let RWebWindowsManager correctly recognize such situation.

Definition at line 74 of file RWebWindowsManager.cxx.

◆ IsUseHttpThread()

bool ROOT::Experimental::RWebWindowsManager::IsUseHttpThread ( ) const
inlineprivate

Returns true if http server use special thread for requests processing (default off)

Definition at line 45 of file RWebWindowsManager.hxx.

◆ IsUseSenderThreads()

bool ROOT::Experimental::RWebWindowsManager::IsUseSenderThreads ( ) const
inlineprivate

Returns true if extra threads to send data via websockets will be used (default off)

Definition at line 48 of file RWebWindowsManager.hxx.

◆ ShowWindow()

unsigned RWebWindowsManager::ShowWindow ( RWebWindow win,
bool  batch_mode,
const RWebDisplayArgs user_args 
)
private

Show window in specified location, see Show() method for more details.

Show web window in specified location.

Parameters
batch_modeindicates that browser will run in headless mode
user_argsspecifies where and how display web window

As display args one can use string like "firefox" or "chrome" - these are two main supported web browsers. See RWebDisplayArgs::SetBrowserKind() for all available options. Default value for the browser can be configured when starting root with –web argument like: "root --web=chrome"

If allowed, same window can be displayed several times (like for TCanvas)

Following parameters can be configured in rootrc file:

WebGui.Chrome: full path to Google Chrome executable WebGui.ChromeBatch: command to start chrome in batch WebGui.ChromeInteractive: command to start chrome in interactive mode WebGui.Firefox: full path to Mozialla Firefox executable WebGui.FirefoxBatch: command to start Firefox in batch mode WebGui.FirefoxInteractive: command to start Firefox in interactive mode WebGui.FirefoxProfile: name of Firefox profile to use WebGui.FirefoxProfilePath: file path to Firefox profile WebGui.FirefoxRandomProfile: usage of random Firefox profile -1 never, 0 - only for batch mode (dflt), 1 - always WebGui.LaunchTmout: time required to start process in seconds (default 30 s) WebGui.OperationTmout: time required to perform WebWindow operation like execute command or update drawings WebGui.RecordData: if specified enables data recording for each web window 0 - off, 1 - on WebGui.JsonComp: compression factor for JSON conversion, if not specified - each widget uses own default values WebGui.ForceHttp: 0 - off (default), 1 - always create real http server to run web window WebGui.Console: -1 - output only console.error(), 0 - add console.warn(), 1 - add console.log() output WebGui.ConnCredits: 10 - number of packets which can be send by server or client without acknowledge from receiving side WebGui.openui5src: alternative location for openui5 like https://openui5.hana.ondemand.com/ WebGui.openui5libs: list of pre-loaded ui5 libs like sap.m, sap.ui.layout, sap.ui.unified WebGui.openui5theme: openui5 theme like sap_belize (default) or sap_fiori_3

HTTP-server related parameters documented in RWebWindowsManager::CreateServer() method

Definition at line 436 of file RWebWindowsManager.cxx.

◆ Terminate()

void RWebWindowsManager::Terminate ( )

Terminate http server and ROOT application.

Definition at line 558 of file RWebWindowsManager.cxx.

◆ Unregister()

void RWebWindowsManager::Unregister ( RWebWindow win)
private

Release all references to specified window Called from RWebWindow destructor.

Definition at line 366 of file RWebWindowsManager.cxx.

◆ WaitFor()

int RWebWindowsManager::WaitFor ( RWebWindow win,
WebWindowWaitFunc_t  check,
bool  timed = false,
double  timelimit = -1 
)
private

Waits until provided check function or lambdas returns non-zero value Regularly calls WebWindow::Sync() method to let run event loop If call from the main thread, runs system events processing Check function has following signature: int func(double spent_tm) Parameter spent_tm is time in seconds, which already spent inside function Waiting will be continued, if function returns zero.

First non-zero value breaks waiting loop and result is returned (or 0 if time is expired). If parameter timed is true, timelimit (in seconds) defines how long to wait

Definition at line 523 of file RWebWindowsManager.cxx.

Friends And Related Symbol Documentation

◆ RWebWindow

friend class RWebWindow
friend

Definition at line 33 of file RWebWindowsManager.hxx.

Member Data Documentation

◆ fAddr

std::string ROOT::Experimental::RWebWindowsManager::fAddr
private

! HTTP address of the server

Definition at line 37 of file RWebWindowsManager.hxx.

◆ fIdCnt

unsigned ROOT::Experimental::RWebWindowsManager::fIdCnt {0}
private

! counter for identifiers

Definition at line 39 of file RWebWindowsManager.hxx.

◆ fLaunchTmout

float ROOT::Experimental::RWebWindowsManager::fLaunchTmout {30.}
private

! timeout in seconds to start browser process, default 30s

Definition at line 42 of file RWebWindowsManager.hxx.

◆ fMutex

std::recursive_mutex ROOT::Experimental::RWebWindowsManager::fMutex
private

! main mutex, used for window creations

Definition at line 38 of file RWebWindowsManager.hxx.

◆ fServer

std::unique_ptr<THttpServer> ROOT::Experimental::RWebWindowsManager::fServer
private

! central communication with the all used displays

Definition at line 36 of file RWebWindowsManager.hxx.

◆ fUseHttpThrd

bool ROOT::Experimental::RWebWindowsManager::fUseHttpThrd {false}
private

! use special thread for THttpServer

Definition at line 40 of file RWebWindowsManager.hxx.

◆ fUseSenderThreads

bool ROOT::Experimental::RWebWindowsManager::fUseSenderThreads {false}
private

! use extra threads for sending data from RWebWindow to clients

Definition at line 41 of file RWebWindowsManager.hxx.

Libraries for ROOT::Experimental::RWebWindowsManager:

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