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") {
window->Send(connid,
Form(
"Message%d", counter));
} else if (arg == "get_binary") {
float arr[10];
for (
int n = 0;
n < 10; ++
n)
window->SendBinary(connid, arr, sizeof(arr));
} else if (arg == "halt") {
window->TerminateROOT();
}
}
void server()
{
window->SetDefaultPage("file:client.html");
window->SetDataCallBack(ProcessData);
window->SetGeometry(300, 500);
window->Show();
}
char * Form(const char *fmt,...)
static std::shared_ptr< RWebWindow > Create()
Create new RWebWindow Using default RWebWindowsManager.
- Author
- Sergey Linev
Definition in file server.cxx.