12#include <WebSocketsServer.h>
23 typedef std::function<void(uint8_t client, std::string_view message)> ksWsServerMessageFunc_t;
31 std::unique_ptr<WEBSOCKETS_NETWORK_SERVER_CLASS>
wsListener;
std::unique_ptr< WEBSOCKETS_NETWORK_SERVER_CLASS > wsListener
WS server (listener).
Definition ksWSServer.h:31
virtual ~ksWSServer()
Destructs the server, releasing the resources.
Definition ksWSServer.cpp:22
void begin()
Starts the server.
Definition ksWSServer.cpp:27
void loop()
Handles WebSocket server logic.
Definition ksWSServer.cpp:59
ksWSServer(uint16_t port)
Prepares ksWebServer on specified port without actually starting it.
Definition ksWSServer.cpp:17
ksWsServerMessageFunc_t onWebsocketTextMessage
Callback function to receive messages.
Definition ksWSServer.h:33
uint64_t getRequiredAuthToken() const
Returns simple authentication token for WebSocket authentication process.
Definition ksWSServer.cpp:82
void setMessageHandler(ksWsServerMessageFunc_t func)
Installs a message handler to receive WebSocket text messages.
Definition ksWSServer.cpp:77
void handleNonWebsocketConnection(WSclient_t *client) override
Handler for non-WebSocket connections on websocket port.
Definition ksWSServer.cpp:92
void setRequiredAuthToken(uint64_t authToken)
Sets simple authtoken for WebSocket authentication.
Definition ksWSServer.cpp:87
uint64_t requriedAuthToken
WS auth token.
Definition ksWSServer.h:32