48 const DefaultSocketSendTimeout = 30s;
51 const DefaultHeartbeatInterval = 20;
54 const DefaultHeartbeatMsg =
":hb\n\n";
61 const SseResponseHeader = ...;
65 const DataSerializationSupport = ...;
79 hash<string, ServerSentEventConnection>
ch;
82 int heartbeat = DefaultHeartbeatInterval;
85 string heartbeat_msg = DefaultHeartbeatMsg;
91 string tlk = get_random_string(50);
107 constructor(*HttpServer::AbstractAuthenticator auth, *hash<auto> opts) ;
196 bool startImpl(softstring lid, hash<auto> cx, hash<auto> hdr, Qore::Socket sock);
242 sendOne(softstring
id, hash<SseMessageInfo> msg);
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.
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.
hash< auto > handleRequest(hash< auto > cx, hash< auto > hdr, *data b)
called by the HTTP server to handle incoming HTTP requests
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
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...
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
int getHeartbeat()
returns the connection heartbeat interval as a number of seconds
logWarn(string fmt,...)
Log to the logger.
bool flushIo(ServerSentEventConnection conn, Socket sock)
Flushes I/O in the connection queue.
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.
stopOne(softstring id)
stop given connection ID
the ServerSentEventHandler namespace contains all the objects in the ServerSentEventHandler module
Definition ServerSentEventConnection.qc.dox.h:26