AlexaClientSDK  3.0.0
A cross-platform, modular SDK for interacting with the Alexa Voice Service
Public Member Functions | List of all members
alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer Class Reference

#include <WebSocketServer.h>

Inheritance diagram for alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer:
Inheritance graph
[legend]
Collaboration diagram for alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer:
Collaboration graph
[legend]

Public Member Functions

 WebSocketServer (const std::string &interface, unsigned short port)
 
void setCertificateFile (const std::string &certificateAuthority, const std::string &certificate, const std::string &privateKey)
 
virtual ~WebSocketServer ()=default
 
MessagingServerInterface Functions
bool start () override
 
void writeMessage (const std::string &payload) override
 
void setMessageListener (std::shared_ptr< MessageListenerInterface > messageListener) override
 
void stop () override
 
bool isReady () override
 
void setObserver (const std::shared_ptr< communication::MessagingServerObserverInterface > &observer) override
 
- Public Member Functions inherited from alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerInterface
virtual void setObserver (const std::shared_ptr< MessagingServerObserverInterface > &observer)=0
 

Detailed Description

A MessagingServerInterface implementation using WebSocket. The start method is blocking.

Constructor & Destructor Documentation

◆ WebSocketServer()

alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::WebSocketServer ( const std::string &  interface,
unsigned short  port 
)

Constructor.

Parameters
interfaceNetwork interface to bind / listen.
portPort to bind / listen.

◆ ~WebSocketServer()

virtual alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::~WebSocketServer ( )
virtualdefault

Member Function Documentation

◆ isReady()

bool alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::isReady ( )
overridevirtual

◆ setCertificateFile()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::setCertificateFile ( const std::string &  certificateAuthority,
const std::string &  certificate,
const std::string &  privateKey 
)

Set the SSL certificate and private key files.

Parameters
certificateAuthorityRoot CA to be used for client certificate verification.
certificateServer certificate chain.
privateKeyPrivate key corresponding to Server certificate.

◆ setMessageListener()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::setMessageListener ( std::shared_ptr< MessageListenerInterface messageListener)
overridevirtual

Set a listener interface that is called when new messages are received

Note
Subsequent call to this method override the previous listener.
Parameters
messageListener

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingInterface.

◆ setObserver()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::setObserver ( const std::shared_ptr< communication::MessagingServerObserverInterface > &  observer)
override

◆ start()

bool alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::start ( )
overridevirtual

Start the implementation of the MessagingInterface

Note
The implementation may choose to make this method blocking or non blocking.
Returns
true for success. False otherwise.

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingServerInterface.

◆ stop()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::stop ( )
overridevirtual

◆ writeMessage()

void alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::WebSocketServer::writeMessage ( const std::string &  payload)
overridevirtual

Write a message into a sink

Parameters
payloadan arbitrary string

Implements alexaClientSDK::sampleApplications::ipcServerSampleApp::communication::MessagingInterface.


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

AlexaClientSDK 3.0.0 - Copyright 2016-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved. Licensed under the Apache License, Version 2.0