79 hash<string, ServerSentEventConnection>
ch;
91 string tlk = get_random_string(50);
164 hash<HttpResponseInfo>
handleRequest(hash<auto> cx, hash<auto> hdr, *data b);
240 sendOne(softstring
id, hash<SseMessageInfo> msg);
*AbstractAuthenticator auth
this class represents a connection to an HTTP client
Definition ServerSentEventConnection.qc.dox.h:37
constructor(*HttpServer::AbstractAuthenticator auth, *hash< auto > opts)
Create the object optionally with the given AbstractAuthenticator.
int heartbeat
heartbeat interval in seconds
Definition ServerSentEventHandler.qc.dox.h:82
removeConnectionLocked(string cid)
Called when a connection is removed from the connection map.
setHeartbeat(date seconds)
sets the heartbeat interval as a number of seconds
sendOne(softstring id, hash< SseMessageInfo > msg)
sends a message to the given connection ID
static string serializeDefault(auto v)
Default value serialization.
string getHeartbeatMessage(ServerSentEventConnection conn)
Returns the heartbeat message to send.
const DefaultHeartbeatMsg
default heartbeat message; this is a short comment to be used as a heartbeat message
Definition ServerSentEventHandler.qc.dox.h:54
constructorInit(*hash< auto > opts)
Common constructor initialization.
ServerSentEventConnection getConnectionImpl(Socket sock, hash< auto > cx, hash< auto > hdr, string cid)
Called when a connection is established; the default implementation creates a ServerSentEventConnecti...
string serialization
The value of the serialization option.
Definition ServerSentEventHandler.qc.dox.h:73
sendHeartbeatMsg(ServerSentEventConnection conn, Socket sock)
Send the default heartbeat message.
sendAll(hash< SseMessageInfo > msg)
sends a message to all connected clients
logError(string fmt,...)
Log to the logger.
logDebug(string fmt,...)
Log to the logger.
bool 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...
string tlk
Thread-local key for I/O check.
Definition ServerSentEventHandler.qc.dox.h:91
string heartbeat_msg
heartbeat message returned by getHeartbeatMessage()
Definition ServerSentEventHandler.qc.dox.h:85
RWLock rwl()
connection read-write lock
ServerSentEventConnection doNewConnection(Socket sock, hash< auto > cx, hash< auto > hdr, string cid)
Called when a connection is established; registers the new connection internally.
static string serializeJson(auto v)
JSON value serialization.
constructor(hash< auto > opts)
Create the object optionally with the given optiond.
*list< string > getConnectionIds()
get list of socket connection ids
const Options
known constructor options
Definition ServerSentEventHandler.qc.dox.h:57
connectionRegisteredImpl(ServerSentEventConnection conn)
Called when the connection is registered; the default implementation does nothing.
hash< HttpResponseInfo > handleRequest(hash< auto > cx, hash< auto > hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
logWarn(string fmt,...)
Log to the logger.
bool flushIo(ServerSentEventConnection conn, Socket sock)
Flushes I/O in the connection queue.
const SseResponseHeader
Response header to SSE requests.
Definition ServerSentEventHandler.qc.dox.h:61
registerNewConnectionIntern(string cid, ServerSentEventConnection conn)
Called while holding the write lock to register the new connection.
const DefaultSocketSendTimeout
default socket send timeout
Definition ServerSentEventHandler.qc.dox.h:48
const DataSerializationSupport
Data serialization support.
Definition ServerSentEventHandler.qc.dox.h:65
const DefaultHeartbeatInterval
default heartbeat interval in seconds
Definition ServerSentEventHandler.qc.dox.h:51
hash< string, ServerSentEventConnection > ch
connection hash
Definition ServerSentEventHandler.qc.dox.h:79
code serializer
Value serialization code.
Definition ServerSentEventHandler.qc.dox.h:76
setHeartbeat(softint seconds)
sets the heartbeat interval as a number of seconds
deregisterConnectionImpl(ServerSentEventConnection conn)
Called when the connection terminates; the default implementation does nothing.
replayEventsSince(ServerSentEventConnection conn, auto id)
Resend all events since the given event.
string encodeMessage(hash< SseMessageInfo > msg)
Encode a message for sending.
logInfo(string fmt,...)
Log to the logger.
int getHeartbeat(ServerSentEventConnection conn)
returns the connection heartbeat interval as a number of seconds
stopOne(softstring id)
stop given connection ID
the ServerSentEventHandler namespace contains all the objects in the ServerSentEventHandler module
Definition ServerSentEventConnection.qc.dox.h:26