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 1.19 or better
26
27
28// require type definitions everywhere
29// enable all warnings
30
31
50namespace DebugHandler {
52
61
62public:
64 hash cx;
65protected:
67
68public:
69
71
75
76
78
80 gotMessage(string msg);
81
82
84
88
89
91
95
96 };
97
99
119
120public:
121 WebSocketDebugProgramControl debugProgram;
122 // default socket send timeout
123 //const DefaultSocketSendTimeout = 30s;
124 DebugLogger logger;
126
127
128 log(int verbosity, string fmt, ...);
129
130
131 log2(int verbosity, string fmt, *list<auto> args);
132
133
136
137
139 abstract *string getContentType();
141 abstract string encodeData(auto data);
142
144
149 abstract receiveData(hash cx, string msg);
151
158 sendData(hash cx, auto data);
159
161
168 broadcastData(auto data);
169
171
174 hash handleRequest(hash cx, hash hdr, *data b);
175
176
177 logInfo(string fmt, ...);
178
179
180 logDebug(string fmt, ...);
181
182
183 logError(string fmt, ...);
184
185 };
186
189
190public:
192
200
201
203 *string getContentType();
204
206 string encodeData(auto data);
207
208
210 receiveData(hash cx, string msg);
211
212 };
213
215
220
221public:
222protected:
224 list<AbstractWebSocketDebugHandler> handlers = ();
225
226public:
227
229
232 constructor(string serverName) ;
233
234
236 sendDataImpl(hash cx, auto data);
237
240
243 };
244};
The abstract web socket debug handler class.
Definition: DebugHandler.qm.dox.h:118
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:60
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:64
the main web socket debug handler class implementing internal protocol in YAML format.
Definition: DebugHandler.qm.dox.h:188
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:219
constructor(string serverName)
creates the object
list< AbstractWebSocketDebugHandler > handlers
list of associated AbstractWebSocketDebugHandler handlers
Definition: DebugHandler.qm.dox.h:224
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:50