#include <websocketserverendpoint.h>
Public Types | |
enum | ETLSMode : nap::uint8 { Intermediate = 0, Modern } |
Public Member Functions | |
bool | init (utility::ErrorState &errorState) override |
bool | start (nap::utility::ErrorState &error) override |
![]() | |
~WebSocketServerEndPointSetup () override | |
bool | init (utility::ErrorState &errorState) override |
bool | start (nap::utility::ErrorState &error) override |
bool | isOpen () const override |
void | stop () override |
bool | send (const WebSocketConnection &connection, const std::string &message, EWebSocketOPCode code, nap::utility::ErrorState &error) override |
bool | send (const WebSocketConnection &connection, void const *payload, int length, EWebSocketOPCode code, nap::utility::ErrorState &error) override |
bool | broadcast (const std::string &message, EWebSocketOPCode code, nap::utility::ErrorState &error) override |
bool | broadcast (void const *payload, int length, EWebSocketOPCode code, nap::utility::ErrorState &error) override |
std::string | getHostName (const WebSocketConnection &connection) override |
void | getHostNames (std::vector< std::string > &outHosts) override |
int | getConnectionCount () override |
bool | acceptsNewConnections () override |
Public Attributes | |
ETLSMode | mMode = ETLSMode::Intermediate |
Property: "Mode" TLS configuration mode. More... | |
std::string | mCertificateFile |
Property: "CertificateFile" TLS certificate file (.pem) More... | |
std::string | mPrivateKeyFile |
Property: "PrivateKeyFile" TLS private key file (.key) More... | |
std::string | mPassphrase |
Property: "Passphrase" password for the private key, only required when key is generated with one. More... | |
Additional Inherited Members | |
![]() | |
void | registerListener (IWebSocketServer &server) override |
void | unregisterListener (IWebSocketServer &server) override |
void | run () |
void | onConnectionOpened (wspp::ConnectionHandle connection) |
void | onConnectionClosed (wspp::ConnectionHandle connection) |
void | onConnectionFailed (wspp::ConnectionHandle connection) |
void | onMessageReceived (wspp::ConnectionHandle con, wspp::MessagePtr msg) |
void | onHTTP (wspp::ConnectionHandle con) |
bool | onValidate (wspp::ConnectionHandle con) |
bool | onPing (wspp::ConnectionHandle con, std::string msg) |
bool | disconnect (nap::utility::ErrorState &error) |
![]() | |
bool | mRunning |
If the server is accepting and managing client connections. More... | |
std::mutex | mConnectionMutex |
Ensures connections are added / removed safely. More... | |
std::unordered_set< WebSocketTicketHash > | mClientHashes |
Accepted client ticket hashes. More... | |
websocketpp::server< wspp::ConfigTLS > | mEndPoint |
The websocketpp server end-point. More... | |
uint32 | mLogLevel |
Converted library log level. More... | |
uint32 | mAccessLogLevel |
Log client / server connection data. More... | |
std::future< void > | mServerTask |
The background server thread. More... | |
std::vector< wspp::ConnectionHandle > | mConnections |
List of all low level connections. More... | |
std::mutex | mListenerMutex |
Ensures registration is thread safe. More... | |
std::vector< IWebSocketServer * > | mListeners |
All registered web socket servers. More... | |
Secured web-socket server end point connection. Adds transport layer security (TLS) using the provided certificate and key.
|
strong |
Transport layer security (TLS) mode. See https://wiki.mozilla.org/Security/Server_Side_TLS for more details about the TLS modes.
Enumerator | |
---|---|
Intermediate | Recommended config for general-purpose server. |
Modern | For modern clients with no need for backwards compatibility. |
|
override |
Initializes the server endpoint.
errorState | contains the error when initialization fails |
|
override |
Opens the port and starts listening to connection requests, connection updates and messages in a background thread.
error | contains the error if the operation failed. |
std::string mCertificateFile |
Property: "CertificateFile" TLS certificate file (.pem)
ETLSMode mMode = ETLSMode::Intermediate |
Property: "Mode" TLS configuration mode.
std::string mPassphrase |
Property: "Passphrase" password for the private key, only required when key is generated with one.
std::string mPrivateKeyFile |
Property: "PrivateKeyFile" TLS private key file (.key)