Qore DebugHandler Module Reference 0.2
Loading...
Searching...
No Matches
DebugHandler.qm.dox.h
1// -*- mode: c++; indent-tabs-mode: nil -*-
3
4/* DebugHandler.qm Copyright 2013 - 2024 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
53namespace DebugHandler {
55
64
65public:
67 hash cx;
68protected:
70
71public:
72
74
78
79
81
83 gotMessage(string msg);
84
85
87
91
92
94
98
99 };
100
102
122
123public:
124 WebSocketDebugProgramControl debugProgram;
125 // default socket send timeout
126 //const DefaultSocketSendTimeout = 30s;
127 constructor(WebSocketDebugProgramControl dpc, *HttpServer::AbstractAuthenticator auth, *hash<auto> opts) ;
128
129
132
133
135 abstract *string getContentType();
137 abstract string encodeData(auto data);
138
140
145 abstract receiveData(hash cx, string msg);
147
154 sendData(hash cx, auto data);
155
157
164 broadcastData(auto data);
165
167
170 hash handleRequest(hash cx, hash hdr, *data b);
171
172 };
173
176
177public:
179
187
188
190 *string getContentType();
191
193 string encodeData(auto data);
194
195
197 receiveData(hash cx, string msg);
198
199 };
200
202
207
208public:
209protected:
211 list<AbstractWebSocketDebugHandler> handlers = ();
212
213public:
214
216
219 constructor(string serverName, *Logger::LoggerInterface logger) ;
220
221
223 sendDataImpl(hash cx, auto data);
224
227
230 };
231};
The abstract web socket debug handler class.
Definition DebugHandler.qm.dox.h:121
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:63
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:67
the main web socket debug handler class implementing internal protocol in YAML format.
Definition DebugHandler.qm.dox.h:175
*string getContentType()
returns the MIME type for serialized data
string encodeData(auto data)
encode data as YAML
constructor(WebSocketDebugProgramControl dpc, *HttpServer::AbstractAuthenticator auth, *hash< auto > opts)
create the object optionally with the given AbstractAuthenticator
receiveData(hash cx, string msg)
called when web socket receive data
debug program control via AbstractWebSocketDebugHandler
Definition DebugHandler.qm.dox.h:206
list< AbstractWebSocketDebugHandler > handlers
list of associated AbstractWebSocketDebugHandler handlers
Definition DebugHandler.qm.dox.h:211
sendDataImpl(hash cx, auto data)
sends data to the given connection
addHandler(AbstractWebSocketDebugHandler newHandler)
add web socket handler object to handler list
constructor(string serverName, *Logger::LoggerInterface logger)
creates the object
broadcastDataImpl(auto data)
sends data to all connections
the DebugHandler namespace contains all the objects in the DebugHandler module
Definition DebugHandler.qm.dox.h:53