16 #ifndef ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSERVER_H_ 17 #define ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSERVER_H_ 22 #include <websocketpp/server.hpp> 23 #ifdef ENABLE_WEBSOCKET_SSL 24 #include <asio/ssl.hpp> 32 namespace sampleApplications {
33 namespace ipcServerSampleApp {
34 namespace communication {
71 :
public std::enable_shared_from_this<WebSocketServer>
96 bool start()
override;
98 void setMessageListener(std::shared_ptr<MessageListenerInterface> messageListener)
override;
101 void setObserver(
const std::shared_ptr<communication::MessagingServerObserverInterface>& observer)
override;
106 typedef websocketpp::server<WebSocketConfig> server;
107 using connection_hdl = websocketpp::connection_hdl;
114 void onConnectionOpen(connection_hdl connectionHdl);
121 void onConnectionClose(connection_hdl connectionHdl);
129 void onMessage(connection_hdl connectionHdl, server::message_ptr messagePtr);
131 #ifdef ENABLE_WEBSOCKET_SSL 135 std::shared_ptr<asio::ssl::context> onTlsInit();
144 bool onValidate(connection_hdl connectionHdl);
147 std::atomic_bool m_initialised{
false};
150 server m_webSocketServer;
153 std::shared_ptr<MessageListenerInterface> m_messageListener;
156 connection_hdl m_connection;
168 std::shared_ptr<MessagingServerObserverInterface> m_observer;
176 #endif // ALEXA_CLIENT_SDK_COMMUNICATION_INCLUDE_COMMUNICATION_WEBSOCKETSERVER_H_ Definition: MessagingServerInterface.h:34
WebSocketServer(const std::string &interface, unsigned short port)
::std::string string
Definition: gtest-port.h:1097
Definition: WebSocketServer.h:70
void setObserver(const std::shared_ptr< communication::MessagingServerObserverInterface > &observer) override
void writeMessage(const std::string &payload) override
virtual ~WebSocketServer()=default
Whether or not curl logs should be emitted.
Definition: AVSConnectionManager.h:36
void setCertificateFile(const std::string &certificateAuthority, const std::string &certificate, const std::string &privateKey)
void setMessageListener(std::shared_ptr< MessageListenerInterface > messageListener) override