ofxHTTP
A collection of tools for HTTP.
ofx::HTTP::WebSocketRouteSettings Class Reference

Settings for a WebSocketRoute. More...

#include <WebSocketRoute.h>

Inheritance diagram for ofx::HTTP::WebSocketRouteSettings:
ofx::HTTP::BaseRouteSettings

Public Types

enum  { DEFAULT_BUFFER_SIZE = 8192 }
 
typedef std::set< std::string > SubprotocolSet
 A typedef for subprotocols.
 
typedef std::set< std::string > OriginSet
 A typedef for origins.
 
- Public Types inherited from ofx::HTTP::BaseRouteSettings
typedef std::set< std::string > HTTPMethodSet
 A typedef for HTTPMethodSet.
 
typedef std::set< std::string > MediaTypeSet
 A typedef for a MediaTypeSet.
 

Public Member Functions

 WebSocketRouteSettings (const std::string &routePathPattern=DEFAULT_WEBSOCKET_ROUTE_PATH_PATTERN, bool requireSecurePort=false)
 Create a WebSocketRouteSettings. More...
 
virtual ~WebSocketRouteSettings ()
 Destroy the WebSocketRouteSettings.
 
void setValidSubprotcols (const SubprotocolSet &subprotocols)
 Set the list of valid subprotocols. More...
 
const SubprotocolSetgetValidSubprotocols () const
 Get a set of valid subprotocols. More...
 
void setValidOrigins (const OriginSet &origins)
 Set the list of valid origins. More...
 
const OriginSetgetValidOrigins () const
 Get a set of valid origins. More...
 
void setAutoPingPongResponse (bool autoPingPongResponse)
 
bool getAutoPingPongResponse () const
 
void setKeepAlive (bool keepAlive)
 
bool getKeepAlive () const
 
void setReceiveTimeout (const Poco::Timespan &receiveTimeout)
 Set the receive timeout. More...
 
Poco::Timespan getReceiveTimeout () const
 
void setSendTimeout (const Poco::Timespan &sendTimeout)
 Set the send timeout. More...
 
Poco::Timespan getSendTimeout () const
 
void setPollTimeout (const Poco::Timespan &pollTimeout)
 Set the polling timeout. More...
 
Poco::Timespan getPollTimeout () const
 
void setBufferSize (std::size_t bufferSize)
 Set the WebSocket buffers size. More...
 
std::size_t getBufferSize () const
 Get the WebSocket buffer size. More...
 
- Public Member Functions inherited from ofx::HTTP::BaseRouteSettings
 BaseRouteSettings (const std::string &routePathPattern=BaseRouteSettings::DEFAULT_ROUTE_PATH_PATTERN, bool requireSecurePort=false, bool requireAuthentication=false, const HTTPMethodSet &validHTTPMethods=HTTPMethodSet())
 Create the BaseRouteSettings with the given route path. More...
 
virtual ~BaseRouteSettings ()
 Destroy the BaseRoutSettings.
 
void setRoutePathPattern (const std::string &routePathPattern)
 Set the route path regex pattern. More...
 
const std::string & getRoutePathPattern () const
 
void setRequireSecurePort (bool requireSecurePort)
 Set the secure port requirement. More...
 
bool requireSecurePort () const
 
void setRequireAuthentication (bool requireAuthentication)
 Set the authentication requirement. More...
 
bool requireAuthentication () const
 
void setValidHTTPMethods (const HTTPMethodSet &validHTTPMethods)
 Set the list of valid HTTPMethods. More...
 
const HTTPMethodSetgetValidHTTPMethods () const
 
void setValidContentTypes (const MediaTypeSet &validContentTypes)
 Set the list of valid Content Types. More...
 
const MediaTypeSetgetValidContentTypes () const
 

Static Public Attributes

static const std::string DEFAULT_WEBSOCKET_ROUTE_PATH_PATTERN = "/"
 The default WebSocketRoute path pattern.
 
static const Poco::Timespan DEFAULT_RECEIVE_TIMEOUT = Poco::Timespan(60 * Poco::Timespan::SECONDS)
 
static const Poco::Timespan DEFAULT_SEND_TIMEOUT = Poco::Timespan(60 * Poco::Timespan::SECONDS)
 
static const Poco::Timespan DEFAULT_POLL_TIMEOUT = Poco::Timespan(10 * Poco::Timespan::MILLISECONDS)
 
- Static Public Attributes inherited from ofx::HTTP::BaseRouteSettings
static const std::string DEFAULT_ROUTE_PATH_PATTERN = "/.*"
 The default route path regex pattern. More...
 

Detailed Description

Settings for a WebSocketRoute.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
DEFAULT_BUFFER_SIZE 

Default buffer size in bytes.

Constructor & Destructor Documentation

◆ WebSocketRouteSettings()

ofx::HTTP::WebSocketRouteSettings::WebSocketRouteSettings ( const std::string &  routePathPattern = DEFAULT_WEBSOCKET_ROUTE_PATH_PATTERN,
bool  requireSecurePort = false 
)

Create a WebSocketRouteSettings.

Parameters
routePathPatternThe regex pattern that this route will handle.
requireSecurePortTrue if this route requires communication on an SSL encrypted port.

Member Function Documentation

◆ getAutoPingPongResponse()

bool ofx::HTTP::WebSocketRouteSettings::getAutoPingPongResponse ( ) const
Returns
true iff auto ping pong response is enabled.

◆ getBufferSize()

std::size_t ofx::HTTP::WebSocketRouteSettings::getBufferSize ( ) const

Get the WebSocket buffer size.

Returns
the WebSocket buffers size in bytes.

◆ getKeepAlive()

bool ofx::HTTP::WebSocketRouteSettings::getKeepAlive ( ) const
Returns
true iff keep alive is enabled.

◆ getPollTimeout()

Poco::Timespan ofx::HTTP::WebSocketRouteSettings::getPollTimeout ( ) const
Returns
the poll timeout.

◆ getReceiveTimeout()

Poco::Timespan ofx::HTTP::WebSocketRouteSettings::getReceiveTimeout ( ) const
Returns
the receive timeout.

◆ getSendTimeout()

Poco::Timespan ofx::HTTP::WebSocketRouteSettings::getSendTimeout ( ) const
Returns
the send timeout.

◆ getValidOrigins()

const WebSocketRouteSettings::OriginSet & ofx::HTTP::WebSocketRouteSettings::getValidOrigins ( ) const

Get a set of valid origins.

If empty, all Origin headers will be accepted.

Returns
The set of valid origins.

◆ getValidSubprotocols()

const WebSocketRouteSettings::SubprotocolSet & ofx::HTTP::WebSocketRouteSettings::getValidSubprotocols ( ) const

Get a set of valid subprotocols.

If empty, all requested subprotocols will be accepted.

Returns
The set of valid subprotocols.

◆ setAutoPingPongResponse()

void ofx::HTTP::WebSocketRouteSettings::setAutoPingPongResponse ( bool  autoPingPongResponse)
Parameters
autoPingPongResponseIf set to true, the WebSocket connection will return all PINGs with a PONG.

◆ setBufferSize()

void ofx::HTTP::WebSocketRouteSettings::setBufferSize ( std::size_t  bufferSize)

Set the WebSocket buffers size.

Parameters
bufferSizeThe buffer size in bytes.

◆ setKeepAlive()

void ofx::HTTP::WebSocketRouteSettings::setKeepAlive ( bool  keepAlive)
Parameters
keepAliveTrue iff keep alive should be enabled.

◆ setPollTimeout()

void ofx::HTTP::WebSocketRouteSettings::setPollTimeout ( const Poco::Timespan &  pollTimeout)

Set the polling timeout.

Parameters
pollTimeoutthe polling timeout.

◆ setReceiveTimeout()

void ofx::HTTP::WebSocketRouteSettings::setReceiveTimeout ( const Poco::Timespan &  receiveTimeout)

Set the receive timeout.

Parameters
receiveTimeoutThe amount of time to wait when receiving data.

◆ setSendTimeout()

void ofx::HTTP::WebSocketRouteSettings::setSendTimeout ( const Poco::Timespan &  sendTimeout)

Set the send timeout.

Parameters
sendTimeoutthe send timeout to set.

◆ setValidOrigins()

void ofx::HTTP::WebSocketRouteSettings::setValidOrigins ( const OriginSet origins)

Set the list of valid origins.

An empty set means that any Origin header in the request will be accepted. A non-empty set means that the request origin MUST be in the set.

Parameters
originsA set of valid origins.

◆ setValidSubprotcols()

void ofx::HTTP::WebSocketRouteSettings::setValidSubprotcols ( const SubprotocolSet subprotocols)

Set the list of valid subprotocols.

An empty set means that any requested subprotocol will be accepted. A non-empty set means that the requested subprotocol MUST be in the set.

Parameters
subprotocolsA set of valid subprotocols.

The documentation for this class was generated from the following files: