Logo ROOT   6.12/07
Reference Guide
THttpWSHandler.h
Go to the documentation of this file.
1 // $Id$
2 // Author: Sergey Linev 20/10/2017
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_THttpWSHandler
13 #define ROOT_THttpWSHandler
14 
15 #include "TNamed.h"
16 
17 #include "TList.h"
18 
19 class THttpCallArg;
20 class THttpWSEngine;
21 class THttpServer;
22 
23 class THttpWSHandler : public TNamed {
24 
25 friend class THttpServer;
26 
27 private:
28 
29  THttpWSEngine *FindEngine(UInt_t id) const;
30 
32 
33 protected:
34 
35  TList fEngines; ///<! list of of engines in use, cleaned automatically at the end
36 
37  THttpWSHandler(const char *name, const char *title);
38 
39 public:
40  virtual ~THttpWSHandler();
41 
42  /// Provides content of default web page for registered web-socket handler
43  /// Can be content of HTML page or file name, where content should be taken
44  /// For instance, file:/home/user/test.htm or file:$jsrootsys/files/canvas.htm
45  /// If not specified, default index.htm page will be shown
46  /// Used by the webcanvas
47  virtual TString GetDefaultPageContent() { return ""; }
48 
49  /// Return kTRUE if websocket with given ID exists
50  Bool_t HasWS(UInt_t wsid) const { return FindEngine(wsid) != 0; }
51 
52  void CloseWS(UInt_t wsid);
53 
54  void SendWS(UInt_t wsid, const void *buf, int len);
55 
56  void SendCharStarWS(UInt_t wsid, const char *str);
57 
58  virtual Bool_t ProcessWS(THttpCallArg *arg) = 0;
59 
60  ClassDef(THttpWSHandler, 0) // abstract class for handling websocket requests
61 };
62 
63 #endif
void SendWS(UInt_t wsid, const void *buf, int len)
Bool_t HasWS(UInt_t wsid) const
Return kTRUE if websocket with given ID exists.
virtual ~THttpWSHandler()
Basic string class.
Definition: TString.h:125
bool Bool_t
Definition: RtypesCore.h:59
TList fEngines
! list of of engines in use, cleaned automatically at the end
THttpWSEngine * FindEngine(UInt_t id) const
#define ClassDef(name, id)
Definition: Rtypes.h:320
The TNamed class is the base class for all named ROOT classes.
Definition: TNamed.h:29
void CloseWS(UInt_t wsid)
void SendCharStarWS(UInt_t wsid, const char *str)
A doubly linked list.
Definition: TList.h:44
Bool_t HandleWS(THttpCallArg *arg)
virtual TString GetDefaultPageContent()
Provides content of default web page for registered web-socket handler Can be content of HTML page or...
unsigned int UInt_t
Definition: RtypesCore.h:42
virtual Bool_t ProcessWS(THttpCallArg *arg)=0
THttpWSHandler(const char *name, const char *title)
THttpWSHandler.
char name[80]
Definition: TGX11.cxx:109