![]() |
Qore ServerSentEventHandler Module Reference 1.0.1
|
this class represents a connection to an HTTP client More...
#include <ServerSentEventConnection.qc.dox.h>
Public Member Functions | |
| connectionClosed () | |
| This method is called when the connection is closed. | |
| constructor (ServerSentEventHandler handler, Socket sock, hash< auto > cx, hash< auto > hdr, string cid) | |
| the constructor is called when a new connection is made by an HTTP client | |
| flush () | |
| Flush all output data. | |
| *string | pollData () |
| This method is called to poll for messages from the client to send from the server. | |
| *string | pollDataImmediate () |
| This method is called to poll for messages to send to the client from the server. | |
| registered () | |
| Called when the connection has been registered in handler and accept sending messages. | |
| send (hash< SseMessageInfo > msg) | |
| Pushes an unencoded message on the connection's message queue. | |
| sendEncoded (string msg) | |
| Pushes an already-encoded message on the connection's message queue. | |
| stop () | |
| force closing socket related to connection | |
Public Attributes | |
| string | cid |
| The connection ID. | |
| hash< auto > | cx |
| Original request context. | |
| ServerSentEventHandler | handler |
| The parent handler object. | |
| hash< auto > | hdr |
| Original request header info. | |
| bool | stop_flag = False |
| Stop connection flag. | |
Protected Member Functions | |
| Qore::Thread::Queue | queue () |
| the Queue object stores messages to be sent to the server | |
Protected Attributes | |
| int | tid = gettid() |
| The TID of the I/O thread. | |
Private Attributes | |
| Socket | sock |
| The socket used by the server for this connection. | |
this class represents a connection to an HTTP client
| ServerSentEventHandler::ServerSentEventConnection::connectionClosed | ( | ) |
This method is called when the connection is closed.
Called by the ServerSentEventHandler
The implementation in this class is empty; implement this method in a subclass to provide custom behavior
| ServerSentEventHandler::ServerSentEventConnection::constructor | ( | ServerSentEventHandler | handler, |
| Socket | sock, | ||
| hash< auto > | cx, | ||
| hash< auto > | hdr, | ||
| string | cid ) |
the constructor is called when a new connection is made by an HTTP client
Called from ServerSentEventHandler::getConnectionImpl(), which can be overridden in subclasses to allow a subclass of this class to be used as the connection object
| *string ServerSentEventHandler::ServerSentEventConnection::pollData | ( | ) |
This method is called to poll for messages from the client to send from the server.
Called by the ServerSentEventHandler
| *string ServerSentEventHandler::ServerSentEventConnection::pollDataImmediate | ( | ) |
This method is called to poll for messages to send to the client from the server.
Called by the ServerSentEventHandler
| ServerSentEventHandler::ServerSentEventConnection::registered | ( | ) |
Called when the connection has been registered in handler and accept sending messages.
Can be used to send initial welcome message, for example; the default implementation does nothing
| ServerSentEventHandler::ServerSentEventConnection::send | ( | hash< SseMessageInfo > | msg | ) |
Pushes an unencoded message on the connection's message queue.
The message will be encoded with ServerSentEventUtil::ws_encode_message() before sending