Qore DebugHandler Module Reference  0.1
DebugHandler.qm.dox.h
1 // -*- mode: c++; indent-tabs-mode: nil -*-
3 
4 /* DebugHandler.qm Copyright 2013 - 2017 Qore Technologies, s.r.o.
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23 */
24 
25 // this module requires Qore 0.8.12 or better
26 
27 // require type definitions everywhere
28 // enable all warnings
29 
30 
48 namespace DebugHandler {
51 
60 
61 public:
62  public :
63  WebSocketDebugHandler dhandler;
64 
65 public:
66 
67  private :
70 
71 public:
72 
74  constructor(WebSocketDebugHandler n_handler, hash n_cx);
75 
76 
78 
80  gotMessage(string msg);
81 
82 
84 
87 
89  registered();
90 
91  };
92 
94 
108 
109 public:
110  public :
111  WebSocketDebugProgramControl debugProgram;
112  // default socket send timeout
113  //const DefaultSocketSendTimeout = 30s;
114  DebugLogger logger;
115 
116 public:
117 
119 
124 
125 
126  setLogger(*list args);
127 
128 
129  log(int verbosity, string fmt);
130 
131 
134 
135 
137 
161  hash handleRequest(hash cx, hash hdr, *data b);
162 
163 
164  logInfo(string fmt);
165 
166 
167  logDebug(string fmt);
168 
169 
170  logError(string fmt);
171 
172  };
173 
176 
177 public:
178  private :
179  WebSocketDebugHandler handler;
180 
181 public:
182 
184  constructor(string serverName, *HttpServer::AbstractAuthenticator auth) ;
185 
186 
188 
189 private:
191 public:
192 
193 
195  sendDataImpl(hash cx, auto data);
196 
198  broadcastDataImpl(auto data);
199 
202 
204  *string getContentType();
205  };
206 };
setHandler(*HttpServer::AbstractAuthenticator auth, *list args)
sets the web socket handler object; override in a subclass to provide a custom handler object ...
broadcastDataImpl(auto data)
sends data to all connections
the main web socket debug handler class
Definition: DebugHandler.qm.dox.h:107
registered()
send welcome message to identify itself
constructor(*HttpServer::AbstractAuthenticator auth, WebSocketDebugProgramControl dpc, *list args)
create the object optionally with the given AbstractAuthenticator
hash handleRequest(hash cx, hash hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
list list(...)
WebSocketHandler::WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid)
called when a connection is established; the default implementation creates a WebSocketConnection obj...
sendDataImpl(hash cx, auto data)
sends data to the given connection
constructor(string serverName, *HttpServer::AbstractAuthenticator auth)
creates the object and set the web socket handler object by calling setHandler()
WebSocketHandler getHandler()
returns the web socket handler object
gotMessage(string msg)
this method is called by the WebSocketHandler when message from the client is received ...
the DebugHandler namespace contains all the objects in the DebugHandler module
Definition: DebugHandler.qm.dox.h:49
web socket debug program control class
Definition: DebugHandler.qm.dox.h:175
connectionClosed()
this method is called by the WebSocketHandler when the connection is closed
this class represents a connection to a debug server via websocket client
Definition: DebugHandler.qm.dox.h:59
*string getContentType()
returns the MIME type for serialized data
hash hash(object obj)
constructor(WebSocketDebugHandler n_handler, hash n_cx)
the constructor is called by the WebSocketHandler when a new connection is made by a websocket client...
hash cx
websocket context, cx.id is used for sending messages to particular client
Definition: DebugHandler.qm.dox.h:69