Qore DebugHandler Module Reference 0.1
Loading...
Searching...
No Matches
DebugHandler.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* DebugHandler.qm Copyright 2013 - 2023 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
49namespace DebugHandler {
51
60
61public:
63 hash cx;
64protected:
66
67public:
68
70
74
75
77
79 gotMessage(string msg);
80
81
83
87
88
90
94
95 };
96
98
112
113public:
114 WebSocketDebugProgramControl debugProgram;
115 // default socket send timeout
116 //const DefaultSocketSendTimeout = 30s;
117 DebugLogger logger;
119
120
121 log(int verbosity, string fmt);
122
123
124 log2(int verbosity, string fmt, *list args);
125
126
129
130
132 abstract *string getContentType();
134 abstract string encodeData(auto data);
135
137
140 abstract receiveData(hash cx, string msg);
142
146 sendData(hash cx, auto data);
147
149
153 broadcastData(auto data);
154
156
159 hash handleRequest(hash cx, hash hdr, *data b);
160
161
162 logInfo(string fmt);
163
164
165 logDebug(string fmt);
166
167
168 logError(string fmt);
169
170 };
171
174
175public:
176
178
184
185
187 *string getContentType();
188
190 string encodeData(auto data);
191
192
194 receiveData(hash cx, string msg);
195
196 };
197
199
204
205public:
206protected:
208 list handlers = ();
209
210public:
211
213
216 constructor(string serverName) ;
217
218
220 sendDataImpl(hash cx, auto data);
221
224
227
228 };
229};
The abstract web socket debug handler class.
Definition: DebugHandler.qm.dox.h:111
sendData(hash cx, auto data)
sends data to the given connection
abstract receiveData(hash cx, string msg)
called when web socket receives data
broadcastData(auto data)
sends data to all connections
abstract *string getContentType()
returns the MIME type for serialized data
WebSocketHandler::WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid)
called when a connection is established; the default implementation creates a WebSocketConnection obj...
hash handleRequest(hash cx, hash hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
abstract string encodeData(auto data)
encode websocket data
The class represents a connection to a debug server via websocket client.
Definition: DebugHandler.qm.dox.h:59
connectionClosed()
The method is called by the WebSocketHandler when the connection is closed.
registered()
Notifies debug control host that new connection is registered.
constructor(AbstractWebSocketDebugHandler n_handler, hash n_cx)
The constructor is called by the WebSocketHandler when a new connection is made by a websocket client...
gotMessage(string msg)
The method is called by the WebSocketHandler when message from the client is received.
hash cx
websocket context, cx.id is used for sending messages to particular client, custom field may be added...
Definition: DebugHandler.qm.dox.h:63
the main web socket debug handler class implementing internal protocol in YAML format.
Definition: DebugHandler.qm.dox.h:173
constructor(WebSocketDebugProgramControl dpc, *HttpServer::AbstractAuthenticator auth, *hash opts)
create the object optionally with the given AbstractAuthenticator
*string getContentType()
returns the MIME type for serialized data
string encodeData(auto data)
encode data as YAML
receiveData(hash cx, string msg)
called when web socket receive data
debug program control via AbstractWebSocketDebugHandler
Definition: DebugHandler.qm.dox.h:203
constructor(string serverName)
creates the object
list handlers
list of associated AbstractWebSocketDebugHandler handlers
Definition: DebugHandler.qm.dox.h:208
sendDataImpl(hash cx, auto data)
sends data to the given connection
addHandler(AbstractWebSocketDebugHandler newHandler)
add web socket handler object to handler list
broadcastDataImpl(auto data)
sends data to all connections
the DebugHandler namespace contains all the objects in the DebugHandler module
Definition: DebugHandler.qm.dox.h:49