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 34 of file RWebWindowsManager.hxx.
Public Member Functions | |
RWebWindowsManager () | |
window manager constructor Required here for correct usage of unique_ptr<THttpServer> More... | |
~RWebWindowsManager () | |
window manager destructor Required here for correct usage of unique_ptr<THttpServer> More... | |
std::shared_ptr< RWebWindow > | CreateWindow () |
Creates new window To show window, RWebWindow::Show() have to be called. More... | |
THttpServer * | GetServer () const |
Returns THttpServer instance. More... | |
std::string | GetServerAddr () const |
Returns http address of the server, empty string when not available. More... | |
void | Terminate () |
Terminate http server and ROOT application. More... | |
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. More... | |
static std::shared_ptr< RWebWindowsManager > & | Instance () |
Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel. More... | |
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. More... | |
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: More... | |
float | GetLaunchTmout () const |
Returns timeout for launching new browser process. More... | |
std::string | GetUrl (const RWebWindow &win, bool remote=false) |
Provide URL address to access specified window from inside or from remote. More... | |
bool | IsUseHttpThread () const |
Returns true if http server use special thread for requests processing (default off) More... | |
bool | IsUseSenderThreads () const |
Returns true if extra threads to send data via websockets will be used (default off) More... | |
unsigned | ShowWindow (RWebWindow &win, bool batch_mode, const RWebDisplayArgs &args) |
Show window in specified location, see Show() method for more details. More... | |
void | Unregister (RWebWindow &win) |
Release all references to specified window Called from RWebWindow destructor. More... | |
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. More... | |
Private Attributes | |
std::string | fAddr |
! HTTP address of the server More... | |
unsigned | fIdCnt {0} |
! counter for identifiers More... | |
float | fLaunchTmout {30.} |
! timeout in seconds to start browser process, default 30s More... | |
std::recursive_mutex | fMutex |
! main mutex, used for window creations More... | |
std::unique_ptr< THttpServer > | fServer |
! central communication with the all used displays More... | |
bool | fUseHttpThrd {false} |
! use special thread for THttpServer More... | |
bool | fUseSenderThreads {false} |
! use extra threads for sending data from RWebWindow to clients More... | |
Friends | |
class | RWebWindow |
#include <ROOT/RWebWindowsManager.hxx>
|
default |
window manager constructor Required here for correct usage of unique_ptr<THttpServer>
ROOT::Experimental::RWebWindowsManager::~RWebWindowsManager | ( | ) |
window manager destructor Required here for correct usage of unique_ptr<THttpServer>
Definition at line 104 of file RWebWindowsManager.cxx.
|
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 88 of file RWebWindowsManager.cxx.
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
Following parameter controls browser max-age caching parameter for files (default 3600)
WebGui.HttpMaxAge: 3600
Definition at line 156 of file RWebWindowsManager.cxx.
std::shared_ptr< ROOT::Experimental::RWebWindow > ROOT::Experimental::RWebWindowsManager::CreateWindow | ( | ) |
Creates new window To show window, RWebWindow::Show() have to be called.
Definition at line 282 of file RWebWindowsManager.cxx.
|
inlineprivate |
Returns timeout for launching new browser process.
Definition at line 54 of file RWebWindowsManager.hxx.
|
inline |
Returns THttpServer instance.
Definition at line 73 of file RWebWindowsManager.hxx.
|
inline |
Returns http address of the server, empty string when not available.
Definition at line 76 of file RWebWindowsManager.hxx.
|
private |
Provide URL address to access specified window from inside or from remote.
Definition at line 333 of file RWebWindowsManager.cxx.
|
static |
Returns default window manager Used to display all standard ROOT elements like TCanvas or TFitPanel.
Definition at line 53 of file RWebWindowsManager.cxx.
|
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 76 of file RWebWindowsManager.cxx.
|
inlineprivate |
Returns true if http server use special thread for requests processing (default off)
Definition at line 48 of file RWebWindowsManager.hxx.
|
inlineprivate |
Returns true if extra threads to send data via websockets will be used (default off)
Definition at line 51 of file RWebWindowsManager.hxx.
|
private |
Show window in specified location, see Show() method for more details.
Show web window in specified location.
batch_mode | indicates that browser will run in headless mode |
user_args | specifies 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.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 393 of file RWebWindowsManager.cxx.
void ROOT::Experimental::RWebWindowsManager::Terminate | ( | ) |
Terminate http server and ROOT application.
Definition at line 506 of file RWebWindowsManager.cxx.
|
private |
Release all references to specified window Called from RWebWindow destructor.
Definition at line 324 of file RWebWindowsManager.cxx.
|
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 471 of file RWebWindowsManager.cxx.
|
friend |
Definition at line 36 of file RWebWindowsManager.hxx.
|
private |
! HTTP address of the server
Definition at line 40 of file RWebWindowsManager.hxx.
|
private |
! counter for identifiers
Definition at line 42 of file RWebWindowsManager.hxx.
|
private |
! timeout in seconds to start browser process, default 30s
Definition at line 45 of file RWebWindowsManager.hxx.
|
private |
! main mutex, used for window creations
Definition at line 41 of file RWebWindowsManager.hxx.
|
private |
! central communication with the all used displays
Definition at line 39 of file RWebWindowsManager.hxx.
|
private |
! use special thread for THttpServer
Definition at line 43 of file RWebWindowsManager.hxx.
|
private |
! use extra threads for sending data from RWebWindow to clients
Definition at line 44 of file RWebWindowsManager.hxx.