ofxHTTP
A collection of tools for HTTP.
|
A class representing a WebSocket connection with a single client. More...
#include <WebSocketConnection.h>
Public Member Functions | |
WebSocketConnection (WebSocketRoute &route) | |
Create a WebSocketConnection. More... | |
virtual | ~WebSocketConnection () |
Destroy the WebSocketConnection. | |
void | handleRequest (ServerEventArgs &evt) override |
Handle the ServerEventArgs. More... | |
bool | sendFrame (const WebSocketFrame &frame) const |
Queue a frame to be sent. More... | |
void | stop () override |
Interrupt the handleRequest method if possible. | |
Poco::Net::NameValueCollection | requestHeaders () const |
Poco::Net::SocketAddress | clientAddress () const |
bool | isConnected () const |
std::size_t | sendQueueSize () const |
void | clearSendQueue () |
Clears the send queue. | |
std::size_t | totalBytesSent () const |
Get the total bytes sent to the client. More... | |
std::size_t | totalBytesReceived () const |
Get the total bytes received from the client. More... | |
void | addWebSocketFilter (std::unique_ptr< AbstractWebSocketFilter > filter) |
Take ownership of the passed std::unique_ptr<ExtensionType>. More... | |
Public Member Functions inherited from ofx::HTTP::BaseRouteHandler_< WebSocketRoute > | |
BaseRouteHandler_ (WebSocketRoute &route) | |
Create a BaseRoute. | |
virtual | ~BaseRouteHandler_ () |
Destroy a BaseRoute. | |
void | handleRequest (Poco::Net::HTTPServerRequest &request, Poco::Net::HTTPServerResponse &response) override |
WebSocketRoute & | route () |
Get the dispatching route. | |
Public Member Functions inherited from ofx::HTTP::AbstractRouteHandler | |
virtual | ~AbstractRouteHandler () |
Destroy the AbstractRouteHandler instance. | |
Public Member Functions inherited from ofx::HTTP::AbstractHTTPRequestHandler | |
virtual | ~AbstractHTTPRequestHandler () |
Destroy the AbstractHTTPRequestHandler. | |
Public Member Functions inherited from ofx::HTTP::AbstractServerEventRequestHandler | |
virtual | ~AbstractServerEventRequestHandler () |
Destroy the AbstractServerEventRequestHandler. | |
Additional Inherited Members | |
Protected Attributes inherited from ofx::HTTP::BaseRouteHandler_< WebSocketRoute > | |
WebSocketRoute & | _route |
The route. | |
A class representing a WebSocket connection with a single client.
Frames can be sent across thread boundaries and are queued for sending during the WebSocketConnection's service loop. All accessors are synchronized and thread-safe.
ofx::HTTP::WebSocketConnection::WebSocketConnection | ( | WebSocketRoute & | route | ) |
Create a WebSocketConnection.
route | A reference to the parent WebSocketRoute. |
void ofx::HTTP::WebSocketConnection::addWebSocketFilter | ( | std::unique_ptr< AbstractWebSocketFilter > | filter | ) |
Take ownership of the passed std::unique_ptr<ExtensionType>.
filter | the rvalue reference to the filter. |
Poco::Net::SocketAddress ofx::HTTP::WebSocketConnection::clientAddress | ( | ) | const |
|
overridevirtual |
Handle the ServerEventArgs.
evt | The server request event. |
Implements ofx::HTTP::BaseRouteHandler_< WebSocketRoute >.
bool ofx::HTTP::WebSocketConnection::isConnected | ( | ) | const |
Poco::Net::NameValueCollection ofx::HTTP::WebSocketConnection::requestHeaders | ( | ) | const |
bool ofx::HTTP::WebSocketConnection::sendFrame | ( | const WebSocketFrame & | frame | ) | const |
Queue a frame to be sent.
std::size_t ofx::HTTP::WebSocketConnection::sendQueueSize | ( | ) | const |
std::size_t ofx::HTTP::WebSocketConnection::totalBytesReceived | ( | ) | const |
Get the total bytes received from the client.
std::size_t ofx::HTTP::WebSocketConnection::totalBytesSent | ( | ) | const |
Get the total bytes sent to the client.