sptk2 logo
SPTK Home Page
Public Member Functions | Protected Member Functions | List of all members
sptk::WSListener Class Reference

#include <WSListener.h>

Inheritance diagram for sptk::WSListener:
sptk::TCPServer sptk::ThreadPool sptk::ThreadEvent

Public Member Functions

 WSListener (const WSServices &services, LogEngine &logger, const String &hostname, size_t threadCount, const WSConnection::Options &options)
 
- Public Member Functions inherited from sptk::TCPServer
 TCPServer (const String &listenerName, ServerConnection::Type connectionType, size_t threadLimit=16, LogEngine *logEngine=nullptr, const LogDetails &logDetails=LogDetails())
 
 ~TCPServer () override
 
const Hosthost () const
 
void listen (uint16_t port)
 
void stop () override
 
bool active () const
 
void log (LogPriority priority, const String &message) const
 
const LogDetailslogDetails () const
 
void setSSLKeys (std::shared_ptr< SSLKeys > sslKeys)
 
const SSLKeysgetSSLKeys () const
 
virtual void onConnection (const ServerConnection::Function &function)
 
- Public Member Functions inherited from sptk::ThreadPool
 ThreadPool (uint32_t threadLimit, std::chrono::milliseconds threadIdleSeconds, const String &threadName, LogEngine *logEngine)
 
virtual void execute (const SRunable &task)
 
void threadEvent (Thread *thread, ThreadEvent::Type eventType, SRunable runable) override
 
virtual void stop ()
 
size_t size () const
 
- Public Member Functions inherited from sptk::ThreadEvent
virtual void threadEvent (Thread *thread, Type eventType, SRunable runable)=0
 Thread event callback function. More...
 
virtual ~ThreadEvent ()=default
 Destructor.
 

Protected Member Functions

SServerConnection createConnection (SOCKET connectionSocket, const sockaddr_in *peer) override
 
- Protected Member Functions inherited from sptk::TCPServer
void host (const Host &host)
 
virtual bool allowConnection (sockaddr_in *connectionRequest)
 
virtual SServerConnection createConnection (SOCKET connectionSocket, const sockaddr_in *peer)
 
void threadEvent (Thread *thread, ThreadEvent::Type eventType, SRunable runable) override
 

Additional Inherited Members

- Public Types inherited from sptk::ThreadEvent
enum class  Type : uint8_t {
  THREAD_STARTED , THREAD_FINISHED , RUNABLE_STARTED , RUNABLE_FINISHED ,
  IDLE_TIMEOUT
}
 Thread event type. More...
 

Detailed Description

Web Service Listener

Simple server to accept Web Service requests. Actual request processing is implemented in Web Service request processor, passed to constructor. As a bonus, WSListener also serves static files, located in staticFilesDirectory. That may be used to implement a web application.

Constructor & Destructor Documentation

◆ WSListener()

sptk::WSListener::WSListener ( const WSServices services,
LogEngine logger,
const String hostname,
size_t  threadCount,
const WSConnection::Options options 
)

Constructor

Parameters
serviceWeb Service request processor
loggerLogger
hostnameThis service hostname
threadCountMax number of simultaneously running requests
optionsClient connection options

Member Function Documentation

◆ createConnection()

SServerConnection sptk::WSListener::createConnection ( SOCKET  connectionSocket,
const sockaddr_in *  peer 
)
overrideprotectedvirtual

Creates connection thread derived from CTCPServerConnection

Application should override this method to create concrete connection object. Created connection object is maintained by CTCPServer.

Parameters
connectionSocketAlready accepted incoming connection socket
peerIncoming connection information

Reimplemented from sptk::TCPServer.


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

Fri Oct 14 2022 09:58:48: SPTK 5.4.1