|
|
| connectionRegisteredImpl (ServerSentEventConnection conn) |
| | Called when the connection is registered; the default implementation does nothing.
|
| |
| | constructor (*HttpServer::AbstractAuthenticator auth, *hash< auto > opts) |
| | Create the object optionally with the given AbstractAuthenticator.
|
| |
|
| constructor (hash< auto > opts) |
| | Create the object optionally with the given optiond.
|
| |
|
| deregisterConnectionImpl (ServerSentEventConnection conn) |
| | Called when the connection terminates; the default implementation does nothing.
|
| |
|
ServerSentEventConnection | doNewConnection (Socket sock, hash< auto > cx, hash< auto > hdr, string cid) |
| | Called when a connection is established; registers the new connection internally.
|
| |
|
string | encodeMessage (hash< SseMessageInfo > msg) |
| | Encode a message for sending.
|
| |
| bool | flushIo (ServerSentEventConnection conn, Socket sock) |
| | Flushes I/O in the connection queue.
|
| |
|
*list< string > | getConnectionIds () |
| | get list of socket connection ids
|
| |
|
ServerSentEventConnection | getConnectionImpl (Socket sock, hash< auto > cx, hash< auto > hdr, string cid) |
| | Called when a connection is established; the default implementation creates a ServerSentEventConnection object.
|
| |
| int | getHeartbeat (ServerSentEventConnection conn) |
| | returns the connection heartbeat interval as a number of seconds
|
| |
| hash< HttpResponseInfo > | handleRequest (hash< auto > cx, hash< auto > hdr, *data b) |
| | called by the HTTP server to handle incoming HTTP requests
|
| |
|
| logDebug (string fmt,...) |
| | Log to the logger.
|
| |
|
| logError (string fmt,...) |
| | Log to the logger.
|
| |
|
| logInfo (string fmt,...) |
| | Log to the logger.
|
| |
|
| logWarn (string fmt,...) |
| | Log to the logger.
|
| |
| | sendAll (hash< SseMessageInfo > msg) |
| | sends a message to all connected clients
|
| |
| | sendOne (softstring id, hash< SseMessageInfo > msg) |
| | sends a message to the given connection ID
|
| |
| | setHeartbeat (date seconds) |
| | sets the heartbeat interval as a number of seconds
|
| |
| | setHeartbeat (softint seconds) |
| | sets the heartbeat interval as a number of seconds
|
| |
| 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 should be established.
|
| |
|
| stopOne (softstring id) |
| | stop given connection ID
|
| |
|
|
const | DataSerializationSupport = ... |
| | Data serialization support.
|
| |
|
const | DefaultHeartbeatInterval = 20 |
| | default heartbeat interval in seconds
|
| |
|
const | DefaultHeartbeatMsg = ":hb\n\n" |
| | default heartbeat message; this is a short comment to be used as a heartbeat message
|
| |
|
const | DefaultSocketSendTimeout = 30s |
| | default socket send timeout
|
| |
|
const | Options = ... |
| | known constructor options
|
| |
|
const | SseResponseHeader = ... |
| | Response header to SSE requests.
|
| |
|
|
| constructorInit (*hash< auto > opts) |
| | Common constructor initialization.
|
| |
|
string | getHeartbeatMessage (ServerSentEventConnection conn) |
| | Returns the heartbeat message to send.
|
| |
|
| registerNewConnectionIntern (string cid, ServerSentEventConnection conn) |
| | Called while holding the write lock to register the new connection.
|
| |
|
| removeConnectionLocked (string cid) |
| | Called when a connection is removed from the connection map.
|
| |
|
| replayEventsSince (ServerSentEventConnection conn, auto id) |
| | Resend all events since the given event.
|
| |
|
RWLock | rwl () |
| | connection read-write lock
|
| |
|
| sendHeartbeatMsg (ServerSentEventConnection conn, Socket sock) |
| | Send the default heartbeat message.
|
| |
the main web socket handler class
connections are represented by object descended from ServerSentEventConnection. ServerSentEventHandler::ServerSentEventHandler::getConnectionImpl() returns a suitable object for each connection, this method can be overridden in subclasses to return a custom object for each connection if required.
- Sending ServerSentEvent Message to Clients
- To send a message to an HTTP client, call one of the following methods:
ServerSentEvent connections are identified by their HTTP connection ID as passed in ServerSentEventHandler::handleRequest() in the "cx.id" argument when the connection is first established.