Loading [MathJax]/extensions/tex2jax.js
Logo ROOT  
Reference Guide
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Loading...
Searching...
No Matches
server.cxx File Reference

Detailed Description

This program demonstrates minimal server/client code for working with RWebWindow class File server.cxx shows how RWebWindow can be created and used In client.html simple client code is provided.

std::shared_ptr<ROOT::Experimental::RWebWindow> window;
int counter{0};
void ProcessData(unsigned connid, const std::string &arg)
{
printf("Get msg %s \n", arg.c_str());
counter++;
if (arg == "get_text") {
// send arbitrary text message
window->Send(connid, Form("Message%d", counter));
} else if (arg == "get_binary") {
// send float array as binary
float arr[10];
for (int n = 0; n < 10; ++n)
arr[n] = counter;
window->SendBinary(connid, arr, sizeof(arr));
} else if (arg == "halt") {
// terminate ROOT
window->TerminateROOT();
}
}
void server()
{
// create window
// configure default html page
// either HTML code can be specified or just name of file after 'file:' prefix
window->SetDefaultPage("file:client.html");
// this is call-back, invoked when message received from client
window->SetDataCallBack(ProcessData);
window->SetGeometry(300, 500); // configure predefined geometry
window->Show();
}
char * Form(const char *fmt,...)
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
const Int_t n
Definition legend1.C:16
Author
Sergey Linev

Definition in file server.cxx.