Loading...
Searching...
No Matches
websocketpp::endpoint< connection, config > Class Template Reference

Creates and manages connections associated with a WebSocket endpoint. More...

`#include <endpoint.hpp>`

Inheritance diagram for websocketpp::endpoint< connection, config >:

## Public Types

typedef endpoint< connection, config > | type
typedef config::transport_type | transport_type
| Type of the transport component of this endpoint.
typedef config::concurrency_type | concurrency_type
| Type of the concurrency component of this endpoint.
typedef connection | connection_type
| Type of the connections that this endpoint creates.
typedef connection_type::ptr | connection_ptr
| Shared pointer to connection_type.
typedef connection_type::weak_ptr | connection_weak_ptr
| Weak pointer to connection type.
typedef transport_type::transport_con_type | transport_con_type
typedef transport_con_type::ptr | transport_con_ptr
typedef connection_type::message_handler | message_handler
| Type of message_handler.
typedef connection_type::message_ptr | message_ptr
| Type of message pointers that this endpoint uses.
typedef config::elog_type | elog_type
| Type of error logger.
typedef config::alog_type | alog_type
| Type of access logger.
typedef concurrency_type::scoped_lock_type | scoped_lock_type
| Type of our concurrency policy's scoped lock object.
typedef concurrency_type::mutex_type | mutex_type
| Type of our concurrency policy's mutex object.
typedef config::rng_type | rng_type
| Type of RNG.
typedef connection_type::termination_handler | termination_handler

## Public Member Functions

| endpoint (bool p_is_server)
| ~endpoint ()
| Destructor.
std::string | get_user_agent () const
| Returns the user agent string that this endpoint will use.
void | set_user_agent (std::string const &ua)
| Sets the user agent string that this endpoint will use.
bool | is_server () const
| Returns whether or not this endpoint is a server.
void | set_access_channels (log::level channels)
| Set Access logging channel.
void | clear_access_channels (log::level channels)
| Clear Access logging channels.
void | set_error_channels (log::level channels)
| Set Error logging channel.
void | clear_error_channels (log::level channels)
| Clear Error logging channels.
alog_type & | get_alog ()
| Get reference to access logger.
elog_type & | get_elog ()
| Get reference to error logger.
void | set_open_handler (open_handler h)
void | set_close_handler (close_handler h)
void | set_fail_handler (fail_handler h)
void | set_ping_handler (ping_handler h)
void | set_pong_handler (pong_handler h)
void | set_pong_timeout_handler (pong_timeout_handler h)
void | set_interrupt_handler (interrupt_handler h)
void | set_http_handler (http_handler h)
void | set_validate_handler (validate_handler h)
void | set_message_handler (message_handler h)
void | set_open_handshake_timeout (long dur)
| Set open handshake timeout.
void | set_close_handshake_timeout (long dur)
| Set close handshake timeout.
void | set_pong_timeout (long dur)
| Set pong timeout.
size_t | get_max_message_size () const
| Get default maximum message size.
void | set_max_message_size (size_t new_value)
| Set default maximum message size.
size_t | get_max_http_body_size () const
| Get maximum HTTP message body size.
void | set_max_http_body_size (size_t new_value)
| Set maximum HTTP message body size.
void | interrupt (connection_hdl hdl, lib::error_code &ec)
void | interrupt (connection_hdl hdl)
void | pause_reading (connection_hdl hdl, lib::error_code &ec)
| Pause reading of new data (exception free).
void | pause_reading (connection_hdl hdl)
| Pause reading of new data.
void | resume_reading (connection_hdl hdl, lib::error_code &ec)
| Resume reading of new data (exception free).
void | resume_reading (connection_hdl hdl)
| Resume reading of new data.
void | send_http_response (connection_hdl hdl, lib::error_code &ec)
| Send deferred HTTP Response.
void | send_http_response (connection_hdl hdl)
| Send deferred HTTP Response (exception free).
void | send (connection_hdl hdl, std::string const &payload, frame::opcode::value op, lib::error_code &ec)
| Create a message and add it to the outgoing send queue (exception free).
void | send (connection_hdl hdl, std::string const &payload, frame::opcode::value op)
| Create a message and add it to the outgoing send queue.
void | send (connection_hdl hdl, void const *payload, size_t len, frame::opcode::value op, lib::error_code &ec)
void | send (connection_hdl hdl, void const *payload, size_t len, frame::opcode::value op)
void | send (connection_hdl hdl, message_ptr msg, lib::error_code &ec)
void | send (connection_hdl hdl, message_ptr msg)
void | close (connection_hdl hdl, close::status::value const code, std::string const &reason, lib::error_code &ec)
void | close (connection_hdl hdl, close::status::value const code, std::string const &reason)
void | ping (connection_hdl hdl, std::string const &payload, lib::error_code &ec)
| Send a ping to a specific connection.
void | ping (connection_hdl hdl, std::string const &payload)
| Send a ping to a specific connection.
void | pong (connection_hdl hdl, std::string const &payload, lib::error_code &ec)
| Send a pong to a specific connection.
void | pong (connection_hdl hdl, std::string const &payload)
| Send a pong to a specific connection.
connection_ptr | get_con_from_hdl (connection_hdl hdl, lib::error_code &ec)
| Retrieves a connection_ptr from a connection_hdl (exception free).
connection_ptr | get_con_from_hdl (connection_hdl hdl)
| Retrieves a connection_ptr from a connection_hdl (exception version).

## Protected Member Functions

connection_ptr | create_connection (lib::error_code &ec)

## Protected Attributes

lib::shared_ptr< alog_type > | m_alog
lib::shared_ptr< elog_type > | m_elog

## Detailed Description

template<typename connection, typename config>
class websocketpp::endpoint< connection, config >

Creates and manages connections associated with a WebSocket endpoint.

Definition at line 44 of file endpoint.hpp.

## Member Typedef Documentation

## alog_type

template<typename connection, typename config>

typedef config::alog_type websocketpp::endpoint< connection, config >::alog_type

Type of access logger.

Definition at line 77 of file endpoint.hpp.

## concurrency_type

template<typename connection, typename config>

typedef config::concurrency_type websocketpp::endpoint< connection, config >::concurrency_type

Type of the concurrency component of this endpoint.

Definition at line 53 of file endpoint.hpp.

## connection_ptr

template<typename connection, typename config>

typedef connection_type::ptr websocketpp::endpoint< connection, config >::connection_ptr

Shared pointer to connection_type.

Definition at line 58 of file endpoint.hpp.

## connection_type

template<typename connection, typename config>

typedef connection websocketpp::endpoint< connection, config >::connection_type

Type of the connections that this endpoint creates.

Definition at line 56 of file endpoint.hpp.

## connection_weak_ptr

template<typename connection, typename config>

typedef connection_type::weak_ptr websocketpp::endpoint< connection, config >::connection_weak_ptr

Weak pointer to connection type.

Definition at line 60 of file endpoint.hpp.

## elog_type

template<typename connection, typename config>

typedef config::elog_type websocketpp::endpoint< connection, config >::elog_type

Type of error logger.

Definition at line 75 of file endpoint.hpp.

## message_handler

template<typename connection, typename config>

typedef connection_type::message_handler websocketpp::endpoint< connection, config >::message_handler

Type of message_handler.

Definition at line 70 of file endpoint.hpp.

## message_ptr

template<typename connection, typename config>

typedef connection_type::message_ptr websocketpp::endpoint< connection, config >::message_ptr

Type of message pointers that this endpoint uses.

Definition at line 72 of file endpoint.hpp.

## mutex_type

template<typename connection, typename config>

typedef concurrency_type::mutex_type websocketpp::endpoint< connection, config >::mutex_type

Type of our concurrency policy's mutex object.

Definition at line 82 of file endpoint.hpp.

## rng_type

template<typename connection, typename config>

typedef config::rng_type websocketpp::endpoint< connection, config >::rng_type

Type of RNG.

Definition at line 85 of file endpoint.hpp.

## scoped_lock_type

template<typename connection, typename config>

typedef concurrency_type::scoped_lock_type websocketpp::endpoint< connection, config >::scoped_lock_type

Type of our concurrency policy's scoped lock object.

Definition at line 80 of file endpoint.hpp.

## termination_handler

template<typename connection, typename config>

typedef connection_type::termination_handler websocketpp::endpoint< connection, config >::termination_handler

Definition at line 88 of file endpoint.hpp.

## transport_con_ptr

template<typename connection, typename config>

typedef transport_con_type::ptr websocketpp::endpoint< connection, config >::transport_con_ptr

Type of a shared pointer to the transport component of the connections that this endpoint creates.

Definition at line 67 of file endpoint.hpp.

## transport_con_type

template<typename connection, typename config>

typedef transport_type::transport_con_type websocketpp::endpoint< connection, config >::transport_con_type

Type of the transport component of the connections that this endpoint creates

Definition at line 64 of file endpoint.hpp.

## transport_type

template<typename connection, typename config>

typedef config::transport_type websocketpp::endpoint< connection, config >::transport_type

Type of the transport component of this endpoint.

Definition at line 51 of file endpoint.hpp.

## type

template<typename connection, typename config>

typedef endpoint<connection,config> websocketpp::endpoint< connection, config >::type

Definition at line 48 of file endpoint.hpp.

## Constructor & Destructor Documentation

## endpoint()

template<typename connection, typename config>

websocketpp::endpoint< connection, config >::endpoint | ( | bool | p_is_server | ) |

inline explicit

Definition at line 93 of file endpoint.hpp.

## ~endpoint()

template<typename connection, typename config>

websocketpp::endpoint< connection, config >::~endpoint | ( |  | ) |

inline

Destructor.

Definition at line 114 of file endpoint.hpp.

## Member Function Documentation

## clear_access_channels()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::clear_access_channels | ( | log::level | channels | ) |

inline

Clear Access logging channels.

Clear the access logger's channel value. The value is a number whose interpretation depends on the logging policy in use.

Parameters

  channels | The channel value(s) to clear

Definition at line 233 of file endpoint.hpp.

## clear_error_channels()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::clear_error_channels | ( | log::level | channels | ) |

inline

Clear Error logging channels.

Clear the error logger's channel value. The value is a number whose interpretation depends on the logging policy in use.

Parameters

  channels | The channel value(s) to clear

Definition at line 255 of file endpoint.hpp.

## close() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::close | ( | connection_hdl | hdl,
|  | close::status::value const | code,
|  | std::string const & | reason )

Definition at line 244 of file endpoint_impl.hpp.

## close() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::close | ( | connection_hdl | hdl,
|  | close::status::value const | code,
|  | std::string const & | reason,
|  | lib::error_code & | ec )

Definition at line 160 of file endpoint_impl.hpp.

## create_connection()

template<typename connection, typename config>

endpoint< connection, config >::connection_ptr websocketpp::endpoint< connection, config >::create_connection | ( | lib::error_code & | ec | ) |

protected

Definition at line 37 of file endpoint_impl.hpp.

## get_alog()

template<typename connection, typename config>

alog_type & websocketpp::endpoint< connection, config >::get_alog | ( |  | ) |

inline

Get reference to access logger.

Returns
  A reference to the access logger

Definition at line 263 of file endpoint.hpp.

## get_con_from_hdl() [1/2]

template<typename connection, typename config>

connection_ptr websocketpp::endpoint< connection, config >::get_con_from_hdl | ( | connection_hdl | hdl | ) |

inline

Retrieves a connection_ptr from a connection_hdl (exception version).

Definition at line 655 of file endpoint.hpp.

## get_con_from_hdl() [2/2]

template<typename connection, typename config>

connection_ptr websocketpp::endpoint< connection, config >::get_con_from_hdl | ( | connection_hdl | hdl,
|  | lib::error_code & | ec )

inline

Retrieves a connection_ptr from a connection_hdl (exception free).

Converting a weak pointer to shared_ptr is not thread safe because the pointer could be deleted at any time.

NOTE: This method may be called by handler to upgrade its handle to a full connection_ptr. That full connection may then be used safely for the remainder of the handler body. get_con_from_hdl and the resulting connection_ptr are NOT safe to use outside the handler loop.

Parameters

  hdl | The connection handle to translate

Returns
  the connection_ptr. May be NULL if the handle was invalid.

Definition at line 644 of file endpoint.hpp.

## get_elog()

template<typename connection, typename config>

elog_type & websocketpp::endpoint< connection, config >::get_elog | ( |  | ) |

inline

Get reference to error logger.

Returns
  A reference to the error logger

Definition at line 271 of file endpoint.hpp.

## get_max_http_body_size()

template<typename connection, typename config>

size_t websocketpp::endpoint< connection, config >::get_max_http_body_size | ( |  | ) | const

inline

Get maximum HTTP message body size.

Get maximum HTTP message body size. Maximum message body size determines the point at which the connection will stop reading an HTTP request whose body is too large.

The default is set by the max_http_body_size value from the template config

Since
  0.5.0

Returns
  The maximum HTTP message body size

Definition at line 451 of file endpoint.hpp.

## get_max_message_size()

template<typename connection, typename config>

size_t websocketpp::endpoint< connection, config >::get_max_message_size | ( |  | ) | const

inline

Get default maximum message size.

Get the default maximum message size that will be used for new connections created by this endpoint. The maximum message size determines the point at which the connection will fail a connection with the message_too_big protocol error.

The default is set by the max_message_size value from the template config

Since
  0.3.0

Definition at line 417 of file endpoint.hpp.

## get_user_agent()

template<typename connection, typename config>

std::string websocketpp::endpoint< connection, config >::get_user_agent | ( |  | ) | const

inline

Returns the user agent string that this endpoint will use.

Returns the user agent string that this endpoint will use when creating new connections.

The default value for this version is stored in websocketpp::user_agent

Returns
  The user agent string.

Definition at line 171 of file endpoint.hpp.

## interrupt() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::interrupt | ( | connection_hdl | hdl | ) |

Definition at line 191 of file endpoint_impl.hpp.

## interrupt() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::interrupt | ( | connection_hdl | hdl,
|  | lib::error_code & | ec )

These functions act as adaptors to their counterparts in connection. They can produce one additional type of error, the bad_connection error, that indicates that the conversion from connection_hdl to connection_ptr failed due to the connection not existing anymore. Each method has a default and an exception free variant.

Definition at line 94 of file endpoint_impl.hpp.

## is_server()

template<typename connection, typename config>

bool websocketpp::endpoint< connection, config >::is_server | ( |  | ) | const

inline

Returns whether or not this endpoint is a server.

Returns
  Whether or not this endpoint is a server

Definition at line 207 of file endpoint.hpp.

## pause_reading() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::pause_reading | ( | connection_hdl | hdl | ) |

Pause reading of new data.

Definition at line 198 of file endpoint_impl.hpp.

## pause_reading() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::pause_reading | ( | connection_hdl | hdl,
|  | lib::error_code & | ec )

Pause reading of new data (exception free).

Signals to the connection to halt reading of new data. While reading is paused, the connection will stop reading from its associated socket. In turn this will result in TCP based flow control kicking in and slowing data flow from the remote endpoint.

This is useful for applications that push new requests to a queue to be processed by another thread and need a way to signal when their request queue is full without blocking the network processing thread.

Use resume_reading() to resume.

If supported by the transport this is done asynchronously. As such reading may not stop until the current read operation completes. Typically you can expect to receive no more bytes after initiating a read pause than the size of the read buffer.

If reading is paused for this connection already nothing is changed.

Definition at line 105 of file endpoint_impl.hpp.

## ping() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::ping | ( | connection_hdl | hdl,
|  | std::string const & | payload )

Send a ping to a specific connection.

Exception variant of ping

Since
  0.3.0-alpha3

Parameters

  [in] | hdl | The connection_hdl of the connection to send to.
  [in] | payload | The payload string to send.

Definition at line 253 of file endpoint_impl.hpp.

## ping() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::ping | ( | connection_hdl | hdl,
|  | std::string const & | payload,
|  | lib::error_code & | ec )

Send a ping to a specific connection.

Since
  0.3.0-alpha3

Parameters

  [in] | hdl | The connection_hdl of the connection to send to.
  [in] | payload | The payload string to send.
  [out] | ec | A reference to an error code to fill in

Definition at line 170 of file endpoint_impl.hpp.

## pong() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::pong | ( | connection_hdl | hdl,
|  | std::string const & | payload )

Send a pong to a specific connection.

Exception variant of pong

Since
  0.3.0-alpha3

Parameters

  [in] | hdl | The connection_hdl of the connection to send to.
  [in] | payload | The payload string to send.

Definition at line 261 of file endpoint_impl.hpp.

## pong() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::pong | ( | connection_hdl | hdl,
|  | std::string const & | payload,
|  | lib::error_code & | ec )

Send a pong to a specific connection.

Since
  0.3.0-alpha3

Parameters

  [in] | hdl | The connection_hdl of the connection to send to.
  [in] | payload | The payload string to send.
  [out] | ec | A reference to an error code to fill in

Definition at line 179 of file endpoint_impl.hpp.

## resume_reading() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::resume_reading | ( | connection_hdl | hdl | ) |

Resume reading of new data.

Definition at line 205 of file endpoint_impl.hpp.

## resume_reading() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::resume_reading | ( | connection_hdl | hdl,
|  | lib::error_code & | ec )

Resume reading of new data (exception free).

Signals to the connection to resume reading of new data after it was paused by pause_reading().

If reading is not paused for this connection already nothing is changed.

Definition at line 114 of file endpoint_impl.hpp.

## send() [1/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | message_ptr | msg )

Definition at line 237 of file endpoint_impl.hpp.

## send() [2/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | message_ptr | msg,
|  | lib::error_code & | ec )

Definition at line 151 of file endpoint_impl.hpp.

## send() [3/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | std::string const & | payload,
|  | frame::opcode::value | op )

Create a message and add it to the outgoing send queue.

Convenience method to send a message given a payload string and an opcode

Parameters

  [in] | hdl | The handle identifying the connection to send via.
  [in] | payload | The payload string to generated the message with
  [in] | op | The opcode to generated the message with.

Definition at line 219 of file endpoint_impl.hpp.

## send() [4/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | std::string const & | payload,
|  | frame::opcode::value | op,
|  | lib::error_code & | ec )

Create a message and add it to the outgoing send queue (exception free).

Convenience method to send a message given a payload string and an opcode

Parameters

  [in] | hdl | The handle identifying the connection to send via.
  [in] | payload | The payload string to generated the message with
  [in] | op | The opcode to generated the message with.
  [out] | ec | A code to fill in for errors

Definition at line 132 of file endpoint_impl.hpp.

## send() [5/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | void const * | payload,
|  | size_t | len,
|  | frame::opcode::value | op )

Definition at line 228 of file endpoint_impl.hpp.

## send() [6/6]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send | ( | connection_hdl | hdl,
|  | void const * | payload,
|  | size_t | len,
|  | frame::opcode::value | op,
|  | lib::error_code & | ec )

Definition at line 142 of file endpoint_impl.hpp.

## send_http_response() [1/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send_http_response | ( | connection_hdl | hdl | ) |

Send deferred HTTP Response (exception free).

Sends an http response to an HTTP connection that was deferred. This will send a complete response including all headers, status line, and body text. The connection will be closed afterwards.

Exception variant

Since
  0.6.0

Parameters

  hdl | The connection to send the response on

Definition at line 212 of file endpoint_impl.hpp.

## send_http_response() [2/2]

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::send_http_response | ( | connection_hdl | hdl,
|  | lib::error_code & | ec )

Send deferred HTTP Response.

Sends an http response to an HTTP connection that was deferred. This will send a complete response including all headers, status line, and body text. The connection will be closed afterwards.

Exception free variant

Since
  0.6.0

Parameters

  hdl | The connection to send the response on
  ec | A status code, zero on success, non-zero otherwise

Definition at line 123 of file endpoint_impl.hpp.

## set_access_channels()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_access_channels | ( | log::level | channels | ) |

inline

Set Access logging channel.

Set the access logger's channel value. The value is a number whose interpretation depends on the logging policy in use.

Parameters

  channels | The channel value(s) to set

Definition at line 222 of file endpoint.hpp.

## set_close_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_close_handler | ( | close_handler | h | ) |

inline

Definition at line 284 of file endpoint.hpp.

## set_close_handshake_timeout()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_close_handshake_timeout | ( | long | dur | ) |

inline

Set close handshake timeout.

Sets the length of time the library will wait after a closing handshake has been initiated before cancelling it. This can be used to prevent excessive wait times for outgoing clients or excessive resource usage from broken clients or DoS attacks on servers.

Connections that time out will have their close handlers called with the close_handshake_timeout error code.

The default value is specified via the compile time config value 'timeout_close_handshake'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.

To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.

Parameters

  dur | The length of the close handshake timeout in ms

Definition at line 379 of file endpoint.hpp.

## set_error_channels()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_error_channels | ( | log::level | channels | ) |

inline

Set Error logging channel.

Set the error logger's channel value. The value is a number whose interpretation depends on the logging policy in use.

Parameters

  channels | The channel value(s) to set

Definition at line 244 of file endpoint.hpp.

## set_fail_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_fail_handler | ( | fail_handler | h | ) |

inline

Definition at line 289 of file endpoint.hpp.

## set_http_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_http_handler | ( | http_handler | h | ) |

inline

Definition at line 314 of file endpoint.hpp.

## set_interrupt_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_interrupt_handler | ( | interrupt_handler | h | ) |

inline

Definition at line 309 of file endpoint.hpp.

## set_max_http_body_size()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_max_http_body_size | ( | size_t | new_value | ) |

inline

Set maximum HTTP message body size.

Set maximum HTTP message body size. Maximum message body size determines the point at which the connection will stop reading an HTTP request whose body is too large.

The default is set by the max_http_body_size value from the template config

Since
  0.5.1

Parameters

  new_value | The value to set as the maximum message size.

Definition at line 468 of file endpoint.hpp.

## set_max_message_size()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_max_message_size | ( | size_t | new_value | ) |

inline

Set default maximum message size.

Set the default maximum message size that will be used for new connections created by this endpoint. Maximum message size determines the point at which the connection will fail a connection with the message_too_big protocol error.

The default is set by the max_message_size value from the template config

Since
  0.3.0

Parameters

  new_value | The value to set as the maximum message size.

Definition at line 434 of file endpoint.hpp.

## set_message_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_message_handler | ( | message_handler | h | ) |

inline

Definition at line 324 of file endpoint.hpp.

## set_open_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_open_handler | ( | open_handler | h | ) |

inline

Definition at line 279 of file endpoint.hpp.

## set_open_handshake_timeout()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_open_handshake_timeout | ( | long | dur | ) |

inline

Set open handshake timeout.

Sets the length of time the library will wait after an opening handshake has been initiated before cancelling it. This can be used to prevent excessive wait times for outgoing clients or excessive resource usage from broken clients or DoS attacks on servers.

Connections that time out will have their fail handlers called with the open_handshake_timeout error code.

The default value is specified via the compile time config value 'timeout_open_handshake'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.

To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.

Parameters

  dur | The length of the open handshake timeout in ms

Definition at line 354 of file endpoint.hpp.

## set_ping_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_ping_handler | ( | ping_handler | h | ) |

inline

Definition at line 294 of file endpoint.hpp.

## set_pong_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_pong_handler | ( | pong_handler | h | ) |

inline

Definition at line 299 of file endpoint.hpp.

## set_pong_timeout()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_pong_timeout | ( | long | dur | ) |

inline

Set pong timeout.

Sets the length of time the library will wait for a pong response to a ping. This can be used as a keepalive or to detect broken connections.

Pong responses that time out will have the pong timeout handler called.

The default value is specified via the compile time config value 'timeout_pong'. The default value in the core config is 5000ms. A value of 0 will disable the timer entirely.

To be effective, the transport you are using must support timers. See the documentation for your transport policy for details about its timer support.

Parameters

  dur | The length of the pong timeout in ms

Definition at line 401 of file endpoint.hpp.

## set_pong_timeout_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_pong_timeout_handler | ( | pong_timeout_handler | h | ) |

inline

Definition at line 304 of file endpoint.hpp.

## set_user_agent()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_user_agent | ( | std::string const & | ua | ) |

inline

Sets the user agent string that this endpoint will use.

Sets the identifier that this endpoint will use when creating new connections. Changing this value will only affect future connections. For client endpoints this will be sent as the "User-Agent" header in outgoing requests. For server endpoints this will be sent in the "Server" response header.

Setting this value to the empty string will suppress the use of the Server and User-Agent headers. This is typically done to hide implementation details for security purposes.

For best results set this before accepting or opening connections.

The default value for this version is stored in websocketpp::user_agent

This can be overridden on an individual connection basis by setting a custom "Server" header during the validate handler or "User-Agent" header on a connection before calling connect().

Parameters

  ua | The string to set the user agent to.

Definition at line 198 of file endpoint.hpp.

## set_validate_handler()

template<typename connection, typename config>

void websocketpp::endpoint< connection, config >::set_validate_handler | ( | validate_handler | h | ) |

inline

Definition at line 319 of file endpoint.hpp.

## Member Data Documentation

## m_alog

template<typename connection, typename config>

lib::shared_ptr<alog_type> websocketpp::endpoint< connection, config >::m_alog

protected

Definition at line 667 of file endpoint.hpp.

## m_elog

template<typename connection, typename config>

lib::shared_ptr<elog_type> websocketpp::endpoint< connection, config >::m_elog

protected

Definition at line 668 of file endpoint.hpp.

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

- websocketpp/endpoint.hpp
- websocketpp/impl/endpoint_impl.hpp