150        const DefaultQueuePollingInterval = 250ms;
 
  204    send(data msg, 
int op, 
bool fin);
 
  289        const DefaultSocketSendTimeout = 30s;
 
  292        const DefaultHeartbeatInterval = 20s;
 
  295        const DefaultHeartbeatMsg = 
"heartbeat";
 
  306        hash<string, WebSocketConnection> 
ch;
 
  309        softint heartbeat = DefaultHeartbeatInterval;
 
  312        string heartbeat_msg = DefaultHeartbeatMsg;
 
  318        string tlk = get_random_string(50);
 
  480      static string getDataString(*data d);
 
this class represents a connection to a websocket client
Definition: WebSocketHandler.qm.dox.h:140
 
registered()
Called when the connection has been registered in handler and accept sending messages.
 
setSocket(Socket sock)
Sets the socket used by the server for the connection.
 
flush()
Flush all output data.
 
Qore::Thread::Queue queue()
the Queue object stores messages to be sent to the server
 
int tid
The TID of the I/O thread.
Definition: WebSocketHandler.qm.dox.h:157
 
bool stop_flag
Stop connection flag.
Definition: WebSocketHandler.qm.dox.h:147
 
Socket sock
The socket used by the server for this connection.
Definition: WebSocketHandler.qm.dox.h:163
 
sendEncoded(binary msg)
Pushes an already-encoded message on the connection's message queue.
 
gotMessage(binary msg)
This method is called when messages from the client are received.
 
gotMessage(string msg)
This method is called when messages from the client are received.
 
constructor(WebSocketHandler handler)
the constructor is called when a new connection is made by a websocket client
 
int gotRawMessage(hash< WsMsgInfo > msg)
This method is called when a message is received.
 
*binary pollDataImmediate()
This method is called to poll for messages from the client to send from the server.
 
connectionClosed()
This method is called when the connection is closed.
 
send(data msg, int op, bool fin)
Pushes an unencoded message on the connection's message queue.
 
send(data msg)
Pushes an unencoded message on the connection's message queue.
 
*binary pollData()
This method is called to poll for messages from the client to send from the server.
 
stop()
force closing socket related to connection
 
WebSocketHandler handler
The parent handler object.
Definition: WebSocketHandler.qm.dox.h:144
 
bool flushIo(WebSocketConnection wsc, Socket sock)
Flushes I/O in the connection queue.
 
constructor(*HttpServer::AbstractAuthenticator auth, *hash< auto > opts)
create the object optionally with the given AbstractAuthenticator
 
deregisterConnectionImpl(WebSocketConnection wsc)
called when the connection terminates; the default implementation does nothing
 
*list< string > getConnectionIds()
get list of socket connection ids
 
string getHeartbeatMessage()
returns the heartbeat message as a string
 
setHeartbeat(softint seconds)
sets the heartbeat interval as a number of seconds
 
setHeartbeatMessage(string msg)
sets the heartbeat message
 
logDebug(string fmt)
default implementation is empty
 
RWLock rwl()
connection read-write lock
 
logError(string fmt)
default implementation is empty
 
int getHeartbeat()
returns the connection heartbeat interval as a number of seconds
 
sendOne(softstring id, data d)
sends a message to the given connection ID
 
WebSocketConnection getConnectionImpl(hash< auto > cx, hash< auto > hdr, string cid)
called when a connection is established; the default implementation creates a WebSocketConnection obj...
 
logInfo(string fmt)
default implementation is empty
 
hash< string, WebSocketConnection > ch
connection hash
Definition: WebSocketHandler.qm.dox.h:306
 
startImpl(softstring lid, hash< auto > cx, hash< auto > hdr, Qore::Socket sock)
called from the HTTP server after the handleRequest() method indicates that a dedicated connection sh...
 
WebSocketConnection doNewConnection(hash< auto > cx, hash< auto > hdr, string cid)
called when a connection is established; registers the new connection internally
 
sendAll(data d)
sends a message to all connected clients
 
hash< auto > handleRequest(hash< auto > cx, hash< auto > hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
 
stopOne(softstring id)
stop given connection ID
 
const WSC_Break
If the server should stop listening (message already processed)
Definition: WebSocketHandler.qm.dox.h:123
 
const WSC_Continue
If the server should continue listening (message already processed)
Definition: WebSocketHandler.qm.dox.h:120
 
const WSC_Process
Definition: WebSocketHandler.qm.dox.h:117
 
the WebSocketHandler namespace contains all the objects in the WebSocketHandler module
Definition: WebSocketHandler.qm.dox.h:112