DebugHandler.qm.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
/* DebugHandler.qm Copyright 2013 - 2017 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
// this module requires Qore 0.8.12 or better
// require type definitions everywhere
// enable all warnings
namespace DebugHandler {
class WebSocketDebugConnection : public WebSocketHandler::WebSocketConnection {
public:
public :
WebSocketDebugHandler dhandler;
public:
private :
hash cx;
public:
constructor(WebSocketDebugHandler n_handler, hash n_cx);
gotMessage(string msg);
connectionClosed();
registered();
};
class WebSocketDebugHandler : public WebSocketHandler::WebSocketHandler {
public:
public :
WebSocketDebugProgramControl debugProgram;
// default socket send timeout
//const DefaultSocketSendTimeout = 30s;
DebugLogger logger;
public:
constructor(*HttpServer::AbstractAuthenticator auth, WebSocketDebugProgramControl dpc, *list args) ;
setLogger(*list args);
log(int verbosity, string fmt);
WebSocketHandler::WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid);
hash handleRequest(hash cx, hash hdr, *data b);
logInfo(string fmt);
logDebug(string fmt);
logError(string fmt);
};
class WebSocketDebugProgramControl : public DebugProgramControl {
public:
private :
WebSocketDebugHandler handler;
public:
constructor(string serverName, *HttpServer::AbstractAuthenticator auth) ;
private:
setHandler(*HttpServer::AbstractAuthenticator auth, *list args);
public:
sendDataImpl(hash cx, auto data);
broadcastDataImpl(auto data);
WebSocketHandler getHandler();
*string getContentType();
};
};
DebugHandler::WebSocketDebugProgramControl::setHandler
setHandler(*HttpServer::AbstractAuthenticator auth, *list args)
sets the web socket handler object; override in a subclass to provide a custom handler object ...
DebugHandler::WebSocketDebugProgramControl::broadcastDataImpl
broadcastDataImpl(auto data)
sends data to all connections
DebugHandler::WebSocketDebugHandler
the main web socket debug handler class
Definition: DebugHandler.qm.dox.h:107
HttpServer::AbstractHttpRequestHandler::auth
*AbstractAuthenticator auth
DebugHandler::WebSocketDebugConnection::registered
registered()
send welcome message to identify itself
DebugHandler::WebSocketDebugHandler::constructor
constructor(*HttpServer::AbstractAuthenticator auth, WebSocketDebugProgramControl dpc, *list args)
create the object optionally with the given AbstractAuthenticator
DebugHandler::WebSocketDebugHandler::handleRequest
hash handleRequest(hash cx, hash hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
WebSocketHandler::WebSocketConnection
list
list list(...)
HttpServer::AbstractAuthenticator
DebugHandler::WebSocketDebugHandler::getConnectionImpl
WebSocketHandler::WebSocketConnection getConnectionImpl(hash cx, hash hdr, string cid)
called when a connection is established; the default implementation creates a WebSocketConnection obj...
DebugHandler::WebSocketDebugProgramControl::sendDataImpl
sendDataImpl(hash cx, auto data)
sends data to the given connection
DebugHandler::WebSocketDebugProgramControl::constructor
constructor(string serverName, *HttpServer::AbstractAuthenticator auth)
creates the object and set the web socket handler object by calling setHandler()
DebugHandler::WebSocketDebugProgramControl::getHandler
WebSocketHandler getHandler()
returns the web socket handler object
DebugHandler::WebSocketDebugConnection::gotMessage
gotMessage(string msg)
this method is called by the WebSocketHandler when message from the client is received ...
DebugHandler
the DebugHandler namespace contains all the objects in the DebugHandler module
Definition: DebugHandler.qm.dox.h:49
WebSocketHandler
DebugHandler::WebSocketDebugProgramControl
web socket debug program control class
Definition: DebugHandler.qm.dox.h:175
DebugHandler::WebSocketDebugConnection::connectionClosed
connectionClosed()
this method is called by the WebSocketHandler when the connection is closed
WebSocketHandler::WebSocketHandler
DebugHandler::WebSocketDebugConnection
this class represents a connection to a debug server via websocket client
Definition: DebugHandler.qm.dox.h:59
DebugHandler::WebSocketDebugProgramControl::getContentType
*string getContentType()
returns the MIME type for serialized data
DebugProgramControl
hash
hash hash(object obj)
DebugHandler::WebSocketDebugConnection::constructor
constructor(WebSocketDebugHandler n_handler, hash n_cx)
the constructor is called by the WebSocketHandler when a new connection is made by a websocket client...
DebugHandler::WebSocketDebugConnection::cx
hash cx
websocket context, cx.id is used for sending messages to particular client
Definition: DebugHandler.qm.dox.h:69